@@ -13,4 +15,5 @@ public class BooleanFieldsTest { public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(BooleanFields.class); } -} \ No newline at end of file + +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ConcreteDataListTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ConcreteDataListTest.java index 0967f909..73290cfb 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ConcreteDataListTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ConcreteDataListTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Integration tests for {@link ConcreteDataList}. */ @@ -11,4 +13,9 @@ public class ConcreteDataListTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ConcreteDataList.class); } + + @Test + public void verifyTypeAdapterCorrectness() { + Utils.verifyTypeAdapterCorrectness(ConcreteDataList.class); + } } diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedModelTest.java index 2fd4c2d0..d590b384 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Integration tests for {@link DynamicallyTypedModel}. */ @@ -11,4 +13,5 @@ public class DynamicallyTypedModelTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(DynamicallyTypedModel.class); } + } diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedWildcardTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedWildcardTest.java index 1facac24..d7ab2c30 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedWildcardTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/DynamicallyTypedWildcardTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Integration tests for {@link DynamicallyTypedWildcard}. */ diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/EnumWithFieldsModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/EnumWithFieldsModelTest.java index b051e933..8f69ae23 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/EnumWithFieldsModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/EnumWithFieldsModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by anthonycr on 4/9/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(EnumWithFieldsModel.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalAbstractClassTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalAbstractClassTest.java index 4b4e09c7..a8fd5b96 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalAbstractClassTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalAbstractClassTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasNotGenerated() throws Exception { Utils.verifyNoTypeAdapterGeneration(ExternalAbstractClass.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel1Test.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel1Test.java index 1e63487e..9b0ac3d5 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel1Test.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel1Test.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModel1.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel2Test.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel2Test.java index 5a061de0..7e320a3f 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel2Test.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModel2Test.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModel2.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGeneric1Test.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGeneric1Test.java index 58b2165d..2e7974a4 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGeneric1Test.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGeneric1Test.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelGeneric1.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGenericTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGenericTest.java index 69866fde..cd20cc11 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGenericTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ExternalModelGenericTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelGeneric.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ModelWithNestedInterfaceTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ModelWithNestedInterfaceTest.java index 0d46af2e..de65bb13 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/ModelWithNestedInterfaceTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/ModelWithNestedInterfaceTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/3/17. */ @@ -23,4 +25,4 @@ public void typeAdapterWasNotGenerated_ModelWithNestedInterface_NestedInterface_ Utils.verifyNoTypeAdapterGeneration(ModelWithNestedInterface.NestedInterface.NestedModel.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeArrayTypesTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeArrayTypesTest.java new file mode 100644 index 00000000..dec04f87 --- /dev/null +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeArrayTypesTest.java @@ -0,0 +1,16 @@ +package com.vimeo.sample_java_model; + +import org.junit.Test; + +import verification.Utils; + +/** + * Unit tests for {@link NativeArrayTypes}. + */ +public class NativeArrayTypesTest { + + @Test + public void verifyTypeAdapterWasGenerated() { + Utils.verifyTypeAdapterGeneration(NativeArrayTypes.class); + } +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionTest.java index 4c67338b..139884fb 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + public class NativeJavaModelExtensionTest { @Test @@ -9,4 +11,4 @@ public void typeAdapterWasGenerated_NativeJavaModelExtension() throws Exception Utils.verifyTypeAdapterGeneration(NativeJavaModelExtension.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionWithoutAnnotationTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionWithoutAnnotationTest.java index 5e1d2d5a..78682e5b 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionWithoutAnnotationTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelExtensionWithoutAnnotationTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + public class NativeJavaModelExtensionWithoutAnnotationTest { @Test @@ -9,4 +11,4 @@ public void typeAdapterWasNotGenerated_NativeJavaModelExtension() throws Excepti Utils.verifyNoTypeAdapterGeneration(NativeJavaModelExtensionWithoutAnnotation.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelTest.java index 602b6f26..a513a7fd 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/NativeJavaModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + public class NativeJavaModelTest { @Test @@ -34,4 +36,4 @@ public void typeAdapterWasGenerated_NativeJavaModel_NestedExtensionFromNoAnnotat Utils.verifyTypeAdapterGeneration(NativeJavaModel.NestedExtensionFromNoAnnotation.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/PrivateMembersTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/PrivateMembersTest.java index bf7d89ac..870ab68a 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/PrivateMembersTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/PrivateMembersTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Tests for {@link PrivateMembers}. *
@@ -14,4 +16,4 @@ public void typeAdapterWasGenerated() throws Exception {
Utils.verifyTypeAdapterGeneration(PrivateMembers.class);
}
-}
\ No newline at end of file
+}
diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/RawGenericFieldTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/RawGenericFieldTest.java
index 5b494e48..e176d010 100644
--- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/RawGenericFieldTest.java
+++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/RawGenericFieldTest.java
@@ -2,6 +2,8 @@
import org.junit.Test;
+import verification.Utils;
+
/**
* Integration tests for {@link RawGenericField}.
*/
diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/SuperAbstractDataListTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/SuperAbstractDataListTest.java
index 860bd61e..8dd59536 100644
--- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/SuperAbstractDataListTest.java
+++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/SuperAbstractDataListTest.java
@@ -2,6 +2,8 @@
import org.junit.Test;
+import verification.Utils;
+
/**
* Integration tests for {@link SuperAbstractDataList}.
*/
diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/SwappableParserExampleModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/SwappableParserExampleModelTest.java
index 6c1ad85c..1fc7b6f5 100644
--- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/SwappableParserExampleModelTest.java
+++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/SwappableParserExampleModelTest.java
@@ -32,11 +32,15 @@
import com.vimeo.sample_java_model.stag.generated.Stag;
import org.jetbrains.annotations.NotNull;
-import org.junit.Assert;
import org.junit.Test;
import java.io.IOException;
+import verification.Utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
/**
* Unit tests for {@link SwappableParserExampleModel}.
*/
@@ -55,6 +59,7 @@ public void verifyTypeAdapterWasNotGenerated_TestObject() throws Exception {
/**
* Stag does support being used across Gson instances now
*/
+ @Test
public void test_SwappingTypeAdapters() {
final Stag.Factory factory = new Stag.Factory();
@@ -66,7 +71,7 @@ public void test_SwappingTypeAdapters() {
.registerTypeAdapter(TestObject.class, new TestObjectAdapter1())
.create();
final SwappableParserExampleModel model1 = gson1.fromJson(typeAdapter1Json, SwappableParserExampleModel.class);
- Assert.assertEquals(model1.testField2.testField, "test");
+ assertEquals(model1.testField2.testField, "test");
// TypeAdapter2 assumes a reversed string
final String typeAdapter2Json = swappableParserExampleJsonWithTestObjectField("tset");
@@ -75,7 +80,7 @@ public void test_SwappingTypeAdapters() {
.registerTypeAdapter(TestObject.class, new TestObjectAdapter2())
.create();
final SwappableParserExampleModel model2 = gson2.fromJson(typeAdapter2Json, SwappableParserExampleModel.class);
- Assert.assertEquals(model2.testField2.testField, "test");
+ assertEquals(model2.testField2.testField, "test");
}
/**
@@ -96,7 +101,8 @@ private static String swappableParserExampleJsonWithTestObjectField(@NotNull Str
*/
private static class TestObjectAdapter1 extends TypeAdapter
+ * Created by restainoa on 2/27/18.
+ */
+public class HungarianNotationClassInfoStrategy extends AbstractClassInfoStrategy {
+
+ @Override
+ protected String extractFieldNameFromMethod(String methodName, Pattern pattern) {
+ final String fieldName = super.extractFieldNameFromMethod(methodName, pattern);
+ return "m" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
+ }
+
+}
diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/Utils.java b/integration-test-java/src/test/java/verification/Utils.java
similarity index 69%
rename from integration-test-java/src/test/java/com/vimeo/sample_java_model/Utils.java
rename to integration-test-java/src/test/java/verification/Utils.java
index 9394e8da..b4900ed9 100644
--- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/Utils.java
+++ b/integration-test-java/src/test/java/verification/Utils.java
@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-package com.vimeo.sample_java_model;
+package verification;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
@@ -30,6 +30,12 @@
import org.jetbrains.annotations.NotNull;
+import java.io.IOException;
+
+import uk.co.jemos.podam.api.PodamFactory;
+import uk.co.jemos.podam.api.PodamFactoryImpl;
+
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -54,9 +60,8 @@ private static