mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-05-16 17:41:35 +00:00
Add test for Gson @SerializedName support
This commit is contained in:
parent
4d206e4af6
commit
8394400b2d
30
src/test/java/com/moandjiezana/toml/GsonAnnotationTest.java
Normal file
30
src/test/java/com/moandjiezana/toml/GsonAnnotationTest.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package com.moandjiezana.toml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.moandjiezana.toml.testutils.Utils;
|
||||
|
||||
public class GsonAnnotationTest {
|
||||
|
||||
@Test
|
||||
public void should_support_SerializedName() throws Exception {
|
||||
File file = Utils.file(getClass(), "/GsonAnnotationTest/should_support_SerializedName");
|
||||
GsonAnnotated toml = new Toml().read(file).to(GsonAnnotated.class);
|
||||
|
||||
assertEquals("khfdaiq32-fd12-8420-2214-kafdli4328", toml.nodeId);
|
||||
assertEquals("3", toml.engineVersion);
|
||||
}
|
||||
|
||||
private static class GsonAnnotated {
|
||||
|
||||
@SerializedName("node-id")
|
||||
private String nodeId;
|
||||
@SerializedName("engine_version")
|
||||
private String engineVersion;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
node-id = "khfdaiq32-fd12-8420-2214-kafdli4328"
|
||||
engine_version = "3"
|
Loading…
Reference in a new issue