diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 00000000..457c19d4 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,2 @@ +codecov: + branch: develop diff --git a/.travis.yml b/.travis.yml index 8658533c..baba0273 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,8 @@ jdk: android: components: - tools - - build-tools-27.0.2 - - android-27 + - build-tools-28.0.3 + - android-28 - extra-android-support - extra-android-m2repository # workaround for Google changing android-27 package and causing a checksum mismatch diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f1255ce..45b91325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Change Log ========== +Version 2.6.0 *(2018-10-25)* +---------------------------- +- Improved formatting of generated code. +- Improved logging by putting all debug logging behind the `stagDebug` flag. +- Improve integration of library by switching to new nullability annotations library. +- Wrote unit tests for `KnownTypeAdapters`. +- Fixed bug where code generation was non deterministic by switching to linked versions of `HashSet` and `HashMap`. +- Added support for turning on/off serialization of `null` with `stag.serializeNulls` compiler option. Default is off, which is a behavior change from version 2.5.1. + Version 2.5.1 *(2018-01-17)* ---------------------------- - Fixed bug where types with wildcards caused compilation to fail. diff --git a/README.md b/README.md index e3268a5a..a63669a7 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ buildscript { apply plugin: 'net.ltgt.apt' dependencies { - def stagVersion = '2.5.1' + def stagVersion = '2.6.0' compile "com.vimeo.stag:stag-library:$stagVersion" apt "com.vimeo.stag:stag-library-compiler:$stagVersion" } @@ -45,19 +45,42 @@ dependencies { gradle.projectsEvaluated { tasks.withType(JavaCompile) { aptOptions.processorArgs = [ - stagAssumeHungarianNotation: "true", - stagGeneratedPackageName : "com.vimeo.sample.stag.generated", - stagDebug : "true" + "stagAssumeHungarianNotation": "true", + "stagGeneratedPackageName" : "com.vimeo.sample.stag.generated", + "stagDebug " : "true", + "stag.serializeNulls" : "true", ] } } ``` -### Android Gradle +### Kotlin Gradle +```groovy +apply plugin: 'kotlin-kapt' + +dependencies { + def stagVersion = '2.6.0' + compile "com.vimeo.stag:stag-library:$stagVersion" + kapt "com.vimeo.stag:stag-library-compiler:$stagVersion" +} + +kapt { + correctErrorTypes = true + // Optional annotation processor arguments (see below) + arguments { + arg("stagDebug", "true") + arg("stagGeneratedPackageName", "com.vimeo.sample.stag.generated") + arg("stagAssumeHungarianNotation", "true") + arg("stag.serializeNulls", "true") + } +} +``` + +### Android Gradle (Java) ```groovy dependencies { - def stagVersion = '2.5.1' + def stagVersion = '2.6.0' compile "com.vimeo.stag:stag-library:$stagVersion" annotationProcessor "com.vimeo.stag:stag-library-compiler:$stagVersion" } @@ -70,9 +93,10 @@ android { javaCompileOptions { annotationProcessorOptions { arguments = [ - stagAssumeHungarianNotation: 'true' - stagGeneratedPackageName : 'com.vimeo.sample.stag.generated', - stagDebug : 'true' + "stagAssumeHungarianNotation": 'true', + "stagGeneratedPackageName" : 'com.vimeo.sample.stag.generated', + "stagDebug" : 'true', + "stag.serializeNulls" : 'true' ] } } @@ -91,6 +115,10 @@ android { Stag will look for members named `set[variable_name]` and `get[variable_name]`. If your member variables are named using Hungarian notation, then you will need to pass true to this parameter so that for a field named `mField`, Stag will look for `setField` and `getField` instead of `setMField` and `getMField`. Default is false. + - `stag.serializeNulls`: By default this is set to false. If an object has a null field and you send it to be serialized by Gson, it is optional + whether or not that field is serialized into the JSON. If this field is set to `false` null fields will not be serialized, and if set to `true`, + they will be serialized. Prior to stag version 2.6.0, null fields were always serialized to JSON. This should not affect most models. However, if + you have a model that has a nullable field that also has a non null default value, then it might be a good idea to turn this option on. ## Features @@ -228,7 +256,7 @@ class Herd { * You parse the list from JSON using * Gson. */ -MyParsingClass { +class MyParsingClass { private Gson gson = new GsonBuilder() .registerTypeAdapterFactory(new Stag.Factory()) .create(); diff --git a/build.gradle b/build.gradle index bce8525d..7cde4888 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,15 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - - ext.kotlinVersion = '1.2.20' - ext.jacocoVersion = '0.7.9' // See http://www.eclemma.org/jacoco/ - ext.gsonVersion = '2.8.2' - - // android dependencies - ext.targetSdk = 27 - ext.minSdk = 14 - ext.buildTools = "27.0.2" - + ext { + kotlinVersion = '1.2.71' + jacocoVersion = '0.7.9' // See http://www.eclemma.org/jacoco/ + gsonVersion = '2.8.2' + assertJ = '3.9.1' + + // android dependencies + targetSdk = 28 + minSdk = 14 + buildTools = "28.0.3" + } repositories { google() jcenter() @@ -17,11 +17,11 @@ buildscript { maven { url "https://plugins.gradle.org/m2/" } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.1' + classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - classpath "net.ltgt.gradle:gradle-apt-plugin:0.11" + classpath 'net.ltgt.gradle:gradle-apt-plugin:0.15' } } @@ -43,5 +43,5 @@ allprojects { subprojects { group = 'com.vimeo.stag' - version = '2.5.1' + version = '2.6.0' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8becd2b3..f83c6b89 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Oct 25 13:24:54 EDT 2017 +#Thu Oct 25 11:29:47 EDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip diff --git a/integration-test-android/build.gradle b/integration-test-android/build.gradle index c22c7ea4..2bcd4248 100644 --- a/integration-test-android/build.gradle +++ b/integration-test-android/build.gradle @@ -33,15 +33,16 @@ android { } dependencies { - testImplementation 'junit:junit:4.12' - - implementation 'com.android.support:appcompat-v7:27.0.2' - implementation 'com.android.support:support-annotations:27.0.2' + implementation 'org.jetbrains:annotations-java5:16.0.2@jar' + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support:support-annotations:28.0.0' implementation project(':stag-library') annotationProcessor project(':stag-library-compiler') implementation "com.google.code.gson:gson:$gsonVersion" + + testImplementation 'junit:junit:4.12' } gradle.projectsEvaluated { diff --git a/integration-test-android/src/main/AndroidManifest.xml b/integration-test-android/src/main/AndroidManifest.xml index f22240a7..c2541512 100644 --- a/integration-test-android/src/main/AndroidManifest.xml +++ b/integration-test-android/src/main/AndroidManifest.xml @@ -1,3 +1 @@ - + diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ClassWithMapTypesTest.java b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ClassWithMapTypesTest.java index d020eea6..b5c310bf 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ClassWithMapTypesTest.java +++ b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ClassWithMapTypesTest.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(ClassWithMapTypes.class); } -} \ No newline at end of file +} diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassExtendedTest.java b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassExtendedTest.java index 8da7f1b1..9606245c 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassExtendedTest.java +++ b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassExtendedTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + public class ComplexGenericClassExtendedTest { @Test @@ -9,4 +11,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ComplexGenericClassExtended.class); } -} \ No newline at end of file +} diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassTest.java b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassTest.java index c67896b6..ed9ee78f 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassTest.java +++ b/integration-test-android/src/test/java/com/vimeo/integration_test_android/ComplexGenericClassTest.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(ComplexGenericClass.class); } -} \ No newline at end of file +} diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/TestModelTest.java b/integration-test-android/src/test/java/com/vimeo/integration_test_android/TestModelTest.java index 6543a718..153f3204 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/TestModelTest.java +++ b/integration-test-android/src/test/java/com/vimeo/integration_test_android/TestModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Unit tests for {@link TestModel}. */ @@ -11,4 +13,4 @@ public class TestModelTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(TestModel.class); } -} \ No newline at end of file +} diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/UnserializablePlatformTypeTest.java b/integration-test-android/src/test/java/com/vimeo/integration_test_android/UnserializablePlatformTypeTest.java index 6ffbd0ef..7a2f6724 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/UnserializablePlatformTypeTest.java +++ b/integration-test-android/src/test/java/com/vimeo/integration_test_android/UnserializablePlatformTypeTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Unit tests for {@link UnserializablePlatformType}. */ @@ -11,4 +13,4 @@ public class UnserializablePlatformTypeTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(UnserializablePlatformType.class); } -} \ No newline at end of file +} diff --git a/integration-test-android/src/test/java/com/vimeo/integration_test_android/Utils.java b/integration-test-android/src/test/java/verification/Utils.java similarity index 98% rename from integration-test-android/src/test/java/com/vimeo/integration_test_android/Utils.java rename to integration-test-android/src/test/java/verification/Utils.java index 61316e9a..aa61acbb 100644 --- a/integration-test-android/src/test/java/com/vimeo/integration_test_android/Utils.java +++ b/integration-test-android/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.integration_test_android; +package verification; import com.google.gson.Gson; import com.google.gson.TypeAdapter; diff --git a/integration-test-java-cross-module/build.gradle b/integration-test-java-cross-module/build.gradle index 3b35b8ac..b76a37a4 100644 --- a/integration-test-java-cross-module/build.gradle +++ b/integration-test-java-cross-module/build.gradle @@ -3,10 +3,11 @@ apply plugin: "net.ltgt.apt" dependencies { implementation "com.google.code.gson:gson:$gsonVersion" - implementation 'com.android.support:support-annotations:27.0.2' + implementation 'org.jetbrains:annotations-java5:16.0.2@jar' + implementation 'com.android.support:support-annotations:28.0.0' implementation project(':stag-library') - apt project(':stag-library-compiler') + annotationProcessor project(':stag-library-compiler') implementation project(':integration-test-java') diff --git a/integration-test-java-cross-module/src/main/AndroidManifest.xml b/integration-test-java-cross-module/src/main/AndroidManifest.xml index ae0c9521..f77162a6 100644 --- a/integration-test-java-cross-module/src/main/AndroidManifest.xml +++ b/integration-test-java-cross-module/src/main/AndroidManifest.xml @@ -1,3 +1 @@ - + diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java index 16d1856f..6e4d7e43 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/NestedClass.java @@ -14,6 +14,7 @@ public class NestedClass { * classes to explicitly specify the annotation in order to enable generation. */ public static class NestedExtension extends NestedClass { + String field; } @@ -42,4 +43,4 @@ public static class NestedWithoutAnnotation { } } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java index 346d0d01..a2eced60 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/ObjectExample.java @@ -4,7 +4,6 @@ /** * Example where Object is one of the member variables - * */ @UseStag public class ObjectExample { diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java index 25305d23..817a4602 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/OuterClassWithInnerModel.java @@ -8,10 +8,10 @@ */ public class OuterClassWithInnerModel { - @UseStag - public static class InnerModel { + @UseStag + public static class InnerModel { - public int version; + public int version; - } + } } diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/SubClassWithSameVariableName.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/SubClassWithSameVariableName.java index c16ff47e..6242a22a 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/SubClassWithSameVariableName.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/SubClassWithSameVariableName.java @@ -4,6 +4,7 @@ import java.util.ArrayList; +@SuppressWarnings("FieldNameHidesFieldInSuperclass") @UseStag public class SubClassWithSameVariableName extends ClassWithArrayTypes { diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java index 3cf7a3fa..80501ad0 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model/json_adapter/TestDeserializer.java @@ -13,6 +13,7 @@ */ public class TestDeserializer implements JsonDeserializer { + @Override public BasicModel2 deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { return context.deserialize(json, BasicModel2.class); diff --git a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java index d711badb..7ec4c980 100644 --- a/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java +++ b/integration-test-java-cross-module/src/main/java/com/vimeo/sample/model1/ParameterizedData.java @@ -7,10 +7,11 @@ /** * Since this class is not annotated with @UseStag, this will use TypeToken for its adapter generation. * As it is of paramterized type, this will use TypeToken.getParameterized() instead of TypeToken.get() + * * @param */ public class ParameterizedData { @SerializedName("list") public List list; -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AccessModifiersTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AccessModifiersTest.java index 348896a8..6e19dc3c 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AccessModifiersTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AccessModifiersTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AnnotationExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AnnotationExampleTest.java index c02626c4..9183bcf3 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AnnotationExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/AnnotationExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithArrayTypesTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithArrayTypesTest.java index e1f471ca..6f2692cd 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithArrayTypesTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithArrayTypesTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithNestedInterfaceTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithNestedInterfaceTest.java index 795cd110..4bc0316e 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithNestedInterfaceTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ClassWithNestedInterfaceTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -18,4 +18,4 @@ public void typeAdapterWasNotGenerated_AvailabilityIntentDef() throws Exception public void typeAdapterWasGenerated_ClassWithNestedInterface() throws Exception { Utils.verifyTypeAdapterGeneration(ClassWithNestedInterface.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ConcreteClassTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ConcreteClassTest.java index aef716d2..b154f509 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ConcreteClassTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ConcreteClassTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/DuplicateNameTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/DuplicateNameTest.java index c5beea56..24bc2607 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/DuplicateNameTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/DuplicateNameTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -13,4 +13,4 @@ public class DuplicateNameTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(DuplicateName.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/EnumExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/EnumExampleTest.java index 9a4e9a42..e7644aa8 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/EnumExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/EnumExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelDerivedExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelDerivedExampleTest.java index 1c746098..1cbe1c45 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelDerivedExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelDerivedExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import com.vimeo.sample_java_model.BaseExternalModel; import org.junit.Test; @@ -22,4 +22,4 @@ public void verifyNoTypeAdapterWasGenerated_BaseExternalModel() throws Exception Utils.verifyNoTypeAdapterGeneration(BaseExternalModel.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample1Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample1Test.java index 85c6d33f..62ae1cb1 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample1Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample1Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelExample1.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample2Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample2Test.java index 46f4a5ad..9661f1fb 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample2Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample2Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelExample2.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample3Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample3Test.java index f7a8c679..89f7cebb 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample3Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExample3Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelExample3.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExampleTest.java index 87551367..87b4f6b9 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ExternalModelExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ExternalModelExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionAllExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionAllExampleTest.java index d76e29b0..fec50867 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionAllExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionAllExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(FieldOptionAllExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionNoneExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionNoneExampleTest.java index 619c5177..d8e2b679 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionNoneExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionNoneExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(FieldOptionNoneExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName2Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName2Test.java index 33d70e1c..83e5aa99 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName2Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName2Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(FieldOptionsSerializedName2.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName3Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName3Test.java index 9ec98eb2..2dcbd76d 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName3Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedName3Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(FieldOptionsSerializedName3.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedNameTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedNameTest.java index 38d702f6..16d467d7 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedNameTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/FieldOptionsSerializedNameTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(FieldOptionsSerializedName.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/GenericClassTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/GenericClassTest.java index 47a91ecf..707e9f22 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/GenericClassTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/GenericClassTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(GenericClass.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/IdenticalFieldTypesTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/IdenticalFieldTypesTest.java index 5ae3276a..9c7cd338 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/IdenticalFieldTypesTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/IdenticalFieldTypesTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(IdenticalFieldTypes.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/KnownTypeAdaptersExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/KnownTypeAdaptersExampleTest.java index cdcdcb0d..eed0b30f 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/KnownTypeAdaptersExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/KnownTypeAdaptersExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(KnownTypeAdaptersExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedClassTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedClassTest.java index dd44b19e..96603e0b 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedClassTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedClassTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedEnumTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedEnumTest.java index 96227dde..fd0baf1a 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedEnumTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedEnumTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -21,4 +21,4 @@ public void typeAdapterWasGenerated_NestedEnum_NestedWithAnnotation() throws Exc Utils.verifyTypeAdapterGeneration(NestedEnum.NestedWithAnnotation.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedModelTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedModelTest.java index 811762b4..c745797b 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedModelTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NestedModelTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -19,4 +19,4 @@ public void typeAdapterWasGenerated_NestedModel_NestedEnum() throws Exception { Utils.verifyTypeAdapterGeneration(NestedModel.NestedEnum.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NoUseStagAnnotationTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NoUseStagAnnotationTest.java index 559f4e87..b9dd8c43 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NoUseStagAnnotationTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/NoUseStagAnnotationTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java index 10df380f..0cad36ca 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/ObjectExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -8,9 +8,10 @@ * Created by anshul.garg on 12/04/17. */ public class ObjectExampleTest { + @Test public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(ObjectExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/OuterClassWithInnerModelTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/OuterClassWithInnerModelTest.java index 1e1b4b25..50768efc 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/OuterClassWithInnerModelTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/OuterClassWithInnerModelTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/PrimitiveTypesExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/PrimitiveTypesExampleTest.java index be8ab62b..dc21d65d 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/PrimitiveTypesExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/PrimitiveTypesExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(PrimitiveTypesExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/RecursiveClassTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/RecursiveClassTest.java index fe10b2da..7d1b1278 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/RecursiveClassTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/RecursiveClassTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(RecursiveClass.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SampleInterfaceTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SampleInterfaceTest.java index 47c79ce0..c42dc4d6 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SampleInterfaceTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SampleInterfaceTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SubClassWithSameVariableNameTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SubClassWithSameVariableNameTest.java index 7f0c84d2..203200bc 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SubClassWithSameVariableNameTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/SubClassWithSameVariableNameTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(SubClassWithSameVariableName.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/TestExternalExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/TestExternalExampleTest.java index 237b7042..7389d31a 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/TestExternalExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/TestExternalExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(TestExternalExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel1Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel1Test.java index 44099041..bcbe2a85 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel1Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel1Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model.basic; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel2Test.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel2Test.java index 066787e2..b3ee511c 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel2Test.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/basic/BasicModel2Test.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model.basic; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(BasicModel2.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java index 6f4c8cd1..fc8583f4 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model/json_adapter/JsonAdapterExampleTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model.json_adapter; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -8,8 +8,9 @@ * Created by anshul.garg on 03/03/17. */ public class JsonAdapterExampleTest { + @Test public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(JsonAdapterExample.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DataTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DataTest.java index d162deb3..bd8f546e 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DataTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DataTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model1; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -14,4 +14,4 @@ public void typeAdapterWasNotGenerated() throws Exception { Utils.verifyNoTypeAdapterGeneration(Data.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DuplicateNameTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DuplicateNameTest.java index f830ca0d..305ae327 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DuplicateNameTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/DuplicateNameTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model1; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -13,4 +13,4 @@ public class DuplicateNameTest { public void verifyTypeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(DuplicateName.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/ParameterizedDataTest.java b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/ParameterizedDataTest.java index 97c4402d..db13be31 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/ParameterizedDataTest.java +++ b/integration-test-java-cross-module/src/test/java/com/vimeo/sample/model1/ParameterizedDataTest.java @@ -1,6 +1,6 @@ package com.vimeo.sample.model1; -import com.vimeo.sample.Utils; +import verification.Utils; import org.junit.Test; @@ -13,4 +13,4 @@ public class ParameterizedDataTest { public void verifyTypeAdapterWasNotGenerated() throws Exception { Utils.verifyNoTypeAdapterGeneration(ParameterizedData.class); } -} \ No newline at end of file +} diff --git a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/Utils.java b/integration-test-java-cross-module/src/test/java/verification/Utils.java similarity index 98% rename from integration-test-java-cross-module/src/test/java/com/vimeo/sample/Utils.java rename to integration-test-java-cross-module/src/test/java/verification/Utils.java index b2c2ab51..846ce734 100644 --- a/integration-test-java-cross-module/src/test/java/com/vimeo/sample/Utils.java +++ b/integration-test-java-cross-module/src/test/java/verification/Utils.java @@ -1,4 +1,4 @@ -package com.vimeo.sample; +package verification; import android.support.annotation.NonNull; diff --git a/integration-test-java/build.gradle b/integration-test-java/build.gradle index 3fe51506..3a3558c5 100644 --- a/integration-test-java/build.gradle +++ b/integration-test-java/build.gradle @@ -2,12 +2,14 @@ apply plugin: 'java' apply plugin: "net.ltgt.apt" dependencies { + implementation 'org.jetbrains:annotations-java5:16.0.2@jar' implementation "com.google.code.gson:gson:$gsonVersion" implementation project(':stag-library') - apt project(':stag-library-compiler') + annotationProcessor project(':stag-library-compiler') testImplementation 'junit:junit:4.12' + testImplementation 'uk.co.jemos.podam:podam:7.2.0.RELEASE' } gradle.projectsEvaluated { diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/AbstractDataList.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/AbstractDataList.java index bfc6418c..fa2b643b 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/AbstractDataList.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/AbstractDataList.java @@ -39,4 +39,22 @@ public abstract class AbstractDataList extends SuperAbstractDataList> { public int page; + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + if (!super.equals(o)) { return false; } + + AbstractDataList that = (AbstractDataList) o; + + return page == that.page; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + page; + return result; + } } diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/AlternateNameModel.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/AlternateNameModel.java index ee2ccab6..8f744c64 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/AlternateNameModel.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/AlternateNameModel.java @@ -27,4 +27,24 @@ public String getAndroidNameVersions() { public void setAndroidNameVersions(String androidNameVersions) { mAndroidNameVersions = androidNameVersions; } -} \ No newline at end of file + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + + AlternateNameModel that = (AlternateNameModel) o; + + if (mAndroidVersions != null ? !mAndroidVersions.equals(that.mAndroidVersions) : that.mAndroidVersions != null) { + return false; + } + return mAndroidNameVersions != null ? mAndroidNameVersions.equals(that.mAndroidNameVersions) : that.mAndroidNameVersions == null; + } + + @Override + public int hashCode() { + int result = mAndroidVersions != null ? mAndroidVersions.hashCode() : 0; + result = 31 * result + (mAndroidNameVersions != null ? mAndroidNameVersions.hashCode() : 0); + return result; + } +} diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/BaseExternalModel.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/BaseExternalModel.java index 7d68bf21..bdce49bb 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/BaseExternalModel.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/BaseExternalModel.java @@ -27,4 +27,22 @@ public int getBaseValue() { public void setBaseValue(int baseValue) { this.mBaseValue = baseValue; } + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + + BaseExternalModel that = (BaseExternalModel) o; + + if (mBaseValue != that.mBaseValue) { return false; } + return mType != null ? mType.equals(that.mType) : that.mType == null; + } + + @Override + public int hashCode() { + int result = mType != null ? mType.hashCode() : 0; + result = 31 * result + mBaseValue; + return result; + } } diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeArrayTypes.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeArrayTypes.java new file mode 100644 index 00000000..905b315e --- /dev/null +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeArrayTypes.java @@ -0,0 +1,21 @@ +package com.vimeo.sample_java_model; + +import com.vimeo.stag.UseStag; + +/** + * An integration test for various array types. + */ +@UseStag +public class NativeArrayTypes { + + public String[] mStrings; + + public Integer[] mIntegers; + + public Boolean[] mBooleans; + + public int[] mInts; + + public boolean[] mBools; + +} diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java index 4208a5c2..40e90f78 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/NativeJavaModel.java @@ -17,6 +17,7 @@ public void setTopLevel(String mTopLevel) { @UseStag public static class Nested { + private String mNested; public String getNested() { @@ -29,6 +30,7 @@ public void setNested(String mNested) { } public static class NestedWithoutAnnotation { + private String mNestedWithoutAnnotation; public String getNestedWithoutAnnotation() { @@ -42,6 +44,7 @@ public void setNestedWithoutAnnotation(String mNestedWithoutAnnotation) { @UseStag public static class NestedExtension extends NativeJavaModel { + private String mNestedExtension; public String getNestedExtension() { @@ -54,6 +57,7 @@ public void setNestedExtension(String mNestedExtension) { } public static class NestedExtensionWithoutAnnotation extends NativeJavaModel { + private String mNestedExtensionWithoutAnnotation; public String getNestedExtensionWithoutAnnotation() { @@ -67,6 +71,7 @@ public void setNestedExtensionWithoutAnnotation(String mNestedExtensionWithoutAn @UseStag public static class NestedExtensionFromNoAnnotation extends NestedWithoutAnnotation { + private String mNestedExtensionFromNoAnnotation; public String getNestedExtensionFromNoAnnotation() { diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/RawGenericField.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/RawGenericField.java index b381a162..6d6ccc66 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/RawGenericField.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/RawGenericField.java @@ -2,6 +2,8 @@ import com.vimeo.stag.UseStag; +import java.util.Map; + /** * Model which references a generically typed object without generic bounds (i.e., as a raw * type). @@ -12,4 +14,10 @@ public class RawGenericField { @SuppressWarnings("rawtypes") public ExternalModelGeneric rawTypedField; + /** + * Tests that map keys and values are handled correctly. + */ + @SuppressWarnings("rawtypes") + public Map rawMap; + } diff --git a/integration-test-java/src/main/java/com/vimeo/sample_java_model/SuperAbstractDataList.java b/integration-test-java/src/main/java/com/vimeo/sample_java_model/SuperAbstractDataList.java index 283c7e4c..5a90f541 100644 --- a/integration-test-java/src/main/java/com/vimeo/sample_java_model/SuperAbstractDataList.java +++ b/integration-test-java/src/main/java/com/vimeo/sample_java_model/SuperAbstractDataList.java @@ -41,4 +41,22 @@ public abstract class SuperAbstractDataList { public T paging; public K data; + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + + SuperAbstractDataList that = (SuperAbstractDataList) o; + + if (paging != null ? !paging.equals(that.paging) : that.paging != null) { return false; } + return data != null ? data.equals(that.data) : that.data == null; + } + + @Override + public int hashCode() { + int result = paging != null ? paging.hashCode() : 0; + result = 31 * result + (data != null ? data.hashCode() : 0); + return result; + } } diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AbstractDataListTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AbstractDataListTest.java index c502a862..4441086b 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AbstractDataListTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AbstractDataListTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Integration tests for {@link AbstractDataList}. */ diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModel1Test.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModel1Test.java index 327dd28f..e1d0ea51 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModel1Test.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModel1Test.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,8 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(AlternateNameModel1.class); } -} \ No newline at end of file + @Test + public void verifyTypeAdapterCorrectness() { + Utils.verifyTypeAdapterCorrectness(AlternateNameModel1.class); + } +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModelTest.java index 5210a0a3..518f8e87 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/AlternateNameModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by restainoa on 2/2/17. */ @@ -12,4 +14,8 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(AlternateNameModel.class); } -} \ No newline at end of file + @Test + public void verifyTypeAdapterCorrectness() { + Utils.verifyTypeAdapterCorrectness(AlternateNameModel.class); + } +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/BaseExternalModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/BaseExternalModelTest.java index 6d719c84..67ac2fe8 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/BaseExternalModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/BaseExternalModelTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Created by anthonycr on 2/7/17. */ @@ -12,4 +14,8 @@ public void typeAdapterWasGenerated() throws Exception { Utils.verifyTypeAdapterGeneration(BaseExternalModel.class); } -} \ No newline at end of file + @Test + public void verifyTypeAdapterCorrectness() { + Utils.verifyTypeAdapterCorrectness(BaseExternalModel.class); + } +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/BooleanFieldsTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/BooleanFieldsTest.java index 7aba4b35..92a28fff 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/BooleanFieldsTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/BooleanFieldsTest.java @@ -2,6 +2,8 @@ import org.junit.Test; +import verification.Utils; + /** * Unit tests for {@link BooleanFields}. *

@@ -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 { - TestObjectAdapter1() {} + TestObjectAdapter1() { + } @Override public void write(JsonWriter out, TestObject value) throws IOException { @@ -111,7 +117,7 @@ public TestObject read(JsonReader in) throws IOException { TestObject object = new TestObject(); in.beginObject(); - Assert.assertTrue("testField".equals(in.nextName())); + assertTrue("testField".equals(in.nextName())); object.testField = in.nextString(); in.endObject(); @@ -124,7 +130,8 @@ public TestObject read(JsonReader in) throws IOException { */ private static class TestObjectAdapter2 extends TypeAdapter { - TestObjectAdapter2() {} + TestObjectAdapter2() { + } @Override public void write(JsonWriter out, TestObject value) throws IOException { @@ -139,7 +146,7 @@ public TestObject read(JsonReader in) throws IOException { TestObject object = new TestObject(); in.beginObject(); - Assert.assertTrue("testField".equals(in.nextName())); + assertTrue("testField".equals(in.nextName())); object.testField = new StringBuilder(in.nextString()).reverse().toString(); in.endObject(); @@ -147,4 +154,4 @@ public TestObject read(JsonReader in) throws IOException { } } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WildcardModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WildcardModelTest.java index d23ad89e..c87064a6 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WildcardModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WildcardModelTest.java @@ -4,6 +4,8 @@ import org.junit.Test; +import verification.Utils; + @UseStag public class WildcardModelTest { @@ -11,4 +13,4 @@ public class WildcardModelTest { public void typeAdapterWasGenerated_WildcardModel() throws Exception { Utils.verifyTypeAdapterGeneration(WildcardModel.class); } -} \ No newline at end of file +} diff --git a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java index a0de5975..4db882fb 100644 --- a/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java +++ b/integration-test-java/src/test/java/com/vimeo/sample_java_model/WrapperTypeAdapterModelTest.java @@ -8,13 +8,14 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.vimeo.sample_java_model.WrapperTypeAdapterModel.InnerType; +import com.vimeo.sample_java_model.stag.generated.Stag; import org.junit.Test; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -import com.vimeo.sample_java_model.stag.generated.Stag; +import verification.Utils; import static org.junit.Assert.assertEquals; diff --git a/integration-test-java/src/test/java/verification/HungarianNotationClassInfoStrategy.java b/integration-test-java/src/test/java/verification/HungarianNotationClassInfoStrategy.java new file mode 100644 index 00000000..00267ae1 --- /dev/null +++ b/integration-test-java/src/test/java/verification/HungarianNotationClassInfoStrategy.java @@ -0,0 +1,20 @@ +package verification; + +import java.util.regex.Pattern; + +import uk.co.jemos.podam.api.AbstractClassInfoStrategy; + +/** + * A class info strategy that allows for hungarian notation in field names. + *

+ * 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 TypeAdapter getTypeAdapter(@NotNull Class clazz) { * * @param clazz the class to check. * @param the type of the class, used internally. - * @throws Exception throws an exception if an adapter was not generated. */ - public static void verifyTypeAdapterGeneration(@NotNull Class clazz) throws Exception { + public static void verifyTypeAdapterGeneration(@NotNull Class clazz) { TypeAdapter typeAdapter = getTypeAdapter(clazz); assertNotNull("Type adapter should have been generated by Stag", typeAdapter); } @@ -66,11 +71,35 @@ public static void verifyTypeAdapterGeneration(@NotNull Class clazz) thro * * @param clazz the class to check. * @param the type of the class, used internally. - * @throws Exception throws an exception if an adapter was generated. */ - public static void verifyNoTypeAdapterGeneration(@NotNull Class clazz) throws Exception { + public static void verifyNoTypeAdapterGeneration(@NotNull Class clazz) { TypeAdapter typeAdapter = getTypeAdapter(clazz); assertNull("Type adapter should not have been generated by Stag", typeAdapter); } + /** + * Verifies that the type adapter for a class is correct. It does this by manufacturing an + * instance of the class, writing it to JSON, and then reading that object back out of JSON + * and comparing the two instances. + * + * @param clazz the {@link Class} to use to get the {@link TypeAdapter}. + */ + public static void verifyTypeAdapterCorrectness(@NotNull Class clazz) { + final PodamFactory factory = new PodamFactoryImpl(); + factory.setClassStrategy(new HungarianNotationClassInfoStrategy()); + + final T object = factory.manufacturePojo(clazz); + final TypeAdapter typeAdapter = getTypeAdapter(clazz); + + T newObject = null; + if (typeAdapter != null) { + final String json = typeAdapter.toJson(object); + try { + newObject = typeAdapter.fromJson(json); + } catch (IOException ignored) {} + } + + assertEquals(object, newObject); + } + } diff --git a/integration-test-kotlin/build.gradle b/integration-test-kotlin/build.gradle index 47e282ed..712f285e 100644 --- a/integration-test-kotlin/build.gradle +++ b/integration-test-kotlin/build.gradle @@ -2,12 +2,14 @@ apply plugin: 'kotlin' apply plugin: 'kotlin-kapt' dependencies { - testImplementation 'junit:junit:4.12' + implementation "com.google.code.gson:gson:$gsonVersion" implementation project(':stag-library') kapt project(':stag-library-compiler') - implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" + + testImplementation 'junit:junit:4.12' testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion" testImplementation 'uk.co.jemos.podam:podam:7.1.0.RELEASE' } @@ -19,4 +21,4 @@ kapt { arg("stagGeneratedPackageName", "com.vimeo.sample_kotlin.stag.generated") arg("stagAssumeHungarianNotation", "false") } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/BoolFieldsTest.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/BoolFieldsTest.kt index e5e6699f..caf0ef09 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/BoolFieldsTest.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/BoolFieldsTest.kt @@ -1,6 +1,7 @@ package com.vimeo.dummy.sample_kotlin import org.junit.Test +import verification.Utils /** * Unit tests for [BoolFields]. @@ -18,4 +19,4 @@ class BoolFieldsTest { fun verifyTypeAdapterCorrect() { Utils.verifyTypeAdapterCorrectness(BoolFields::class) } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinConcreteExampleTest.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinConcreteExampleTest.kt index 35b958b5..731981a9 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinConcreteExampleTest.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinConcreteExampleTest.kt @@ -1,6 +1,7 @@ package com.vimeo.dummy.sample_kotlin import org.junit.Test +import verification.Utils /** * Unit tests for [KotlinConcreteExample]. @@ -18,4 +19,4 @@ class KotlinConcreteExampleTest { fun verifyTypeAdapterCorrectness() { Utils.verifyTypeAdapterCorrectness(KotlinConcreteExample::class) } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinGenericExampleTest.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinGenericExampleTest.kt index 5f42cd8b..ae8ee6ee 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinGenericExampleTest.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinGenericExampleTest.kt @@ -1,6 +1,7 @@ package com.vimeo.dummy.sample_kotlin import org.junit.Test +import verification.Utils /** * Unit tests for [KotlinGenericExample] @@ -13,4 +14,4 @@ class KotlinGenericExampleTest { fun verifyTypeAdapterGenerated() { Utils.verifyNoTypeAdapterGeneration(KotlinGenericExample::class) } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt index 0225d694..5f2c37c8 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt +++ b/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/KotlinSamplesTest.kt @@ -1,6 +1,7 @@ package com.vimeo.dummy.sample_kotlin import org.junit.Test +import verification.Utils /** * Unit tests for [KotlinSamples]. @@ -9,7 +10,8 @@ import org.junit.Test */ class KotlinSamplesTest { - @Test fun verifyTypeAdapterGenerated() { + @Test + fun verifyTypeAdapterGenerated() { Utils.verifyTypeAdapterGeneration(KotlinSamples::class) } @@ -17,4 +19,4 @@ class KotlinSamplesTest { fun verifyTypeAdapterCorrectness() { Utils.verifyTypeAdapterCorrectness(KotlinSamples::class) } -} \ No newline at end of file +} diff --git a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt b/integration-test-kotlin/src/test/kotlin/verification/Utils.kt similarity index 88% rename from integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt rename to integration-test-kotlin/src/test/kotlin/verification/Utils.kt index d4c75cca..2ad81655 100644 --- a/integration-test-kotlin/src/test/kotlin/com/vimeo/dummy/sample_kotlin/Utils.kt +++ b/integration-test-kotlin/src/test/kotlin/verification/Utils.kt @@ -1,15 +1,16 @@ -package com.vimeo.dummy.sample_kotlin +package verification import com.google.gson.Gson import com.google.gson.TypeAdapter import com.google.gson.reflect.TypeToken import com.vimeo.sample_kotlin.stag.generated.Stag -import junit.framework.Assert -import junit.framework.Assert.assertEquals +import org.junit.Assert.* import uk.co.jemos.podam.api.PodamFactoryImpl import kotlin.reflect.KClass /** + * Unit test utilities. + * * Created by restainoa on 5/8/17. */ class Utils { @@ -35,7 +36,7 @@ class Utils { @Throws(Exception::class) fun verifyTypeAdapterGeneration(clazz: KClass) { val typeAdapter = getTypeAdapter(clazz) - Assert.assertNotNull("Type adapter should have been generated by Stag", typeAdapter) + assertNotNull("Type adapter should have been generated by Stag", typeAdapter) } /** @@ -50,7 +51,7 @@ class Utils { @Throws(Exception::class) fun verifyNoTypeAdapterGeneration(clazz: KClass) { val typeAdapter = getTypeAdapter(clazz) - Assert.assertNull("Type adapter should not have been generated by Stag", typeAdapter) + assertNull("Type adapter should not have been generated by Stag", typeAdapter) } /** @@ -72,4 +73,4 @@ class Utils { } } -} \ No newline at end of file +} diff --git a/sample/build.gradle b/sample/build.gradle index 1d2cfc18..43e9f6ea 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -21,8 +21,8 @@ android { javaCompileOptions { annotationProcessorOptions { arguments = [ - stagGeneratedPackageName: 'com.vimeo.sample.stag.generated', - stagDebug : 'true', + stagGeneratedPackageName : 'com.vimeo.sample.stag.generated', + stagDebug : 'true', stagAssumeHungarianNotation: 'true' ] } @@ -45,7 +45,7 @@ android { dependencies { testImplementation 'junit:junit:4.12' - implementation 'com.android.support:appcompat-v7:27.0.2' + implementation 'com.android.support:appcompat-v7:28.0.0' implementation project(':stag-library') annotationProcessor project(':stag-library-compiler') diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 2235938a..b6e1bc6e 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -1,7 +1,8 @@ - + xmlns:android="http://schemas.android.com/apk/res/android"> @@ -15,11 +16,11 @@ tools:ignore="AllowBackup,GoogleAppIndexingWarning"> - + - + - \ No newline at end of file + diff --git a/sample/src/main/java/com/vimeo/sample/MainActivity.java b/sample/src/main/java/com/vimeo/sample/MainActivity.java index bd9fd6a2..c52a1b96 100644 --- a/sample/src/main/java/com/vimeo/sample/MainActivity.java +++ b/sample/src/main/java/com/vimeo/sample/MainActivity.java @@ -49,9 +49,9 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - final ListView listView = (ListView) findViewById(R.id.list_view); - final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar); - final TextView errorText = (TextView) findViewById(R.id.error_text); + final ListView listView = findViewById(R.id.list_view); + final ProgressBar progressBar = findViewById(R.id.progress_bar); + final TextView errorText = findViewById(R.id.error_text); if (listView == null || progressBar == null || errorText == null) { throw new RuntimeException("Unable to find view"); @@ -93,4 +93,4 @@ protected void onDestroy() { } } -} \ No newline at end of file +} diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index 017b9a29..e8e1252e 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -1,5 +1,6 @@ - + android:layout_height="match_parent" /> - \ No newline at end of file + diff --git a/sample/src/main/res/values/styles.xml b/sample/src/main/res/values/styles.xml index 6e014884..0935c8fb 100644 --- a/sample/src/main/res/values/styles.xml +++ b/sample/src/main/res/values/styles.xml @@ -2,7 +2,7 @@