Repository: flink Updated Branches: refs/heads/master 26509e50d -> 5ac96c7c2
[FLINK-6909] [types] Add tests for Lombok POJOs This closes #6033. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/5ac96c7c Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/5ac96c7c Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/5ac96c7c Branch: refs/heads/master Commit: 5ac96c7c2f59ba2ca7bbafd9606befbc283956b7 Parents: 26509e5 Author: Timo Walther <[email protected]> Authored: Thu May 17 15:54:07 2018 +0200 Committer: Timo Walther <[email protected]> Committed: Tue May 22 14:27:11 2018 +0200 ---------------------------------------------------------------------- flink-core/pom.xml | 9 +++++++- .../java/typeutils/PojoTypeExtractionTest.java | 23 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/5ac96c7c/flink-core/pom.xml ---------------------------------------------------------------------- diff --git a/flink-core/pom.xml b/flink-core/pom.xml index 9826be0..98a2ff9 100644 --- a/flink-core/pom.xml +++ b/flink-core/pom.xml @@ -93,7 +93,7 @@ under the License. <scope>test</scope> </dependency> - <!-- Joda and jackson are used to test that serialization and type extraction + <!-- Joda, jackson, and lombok are used to test that serialization and type extraction work with types from those libraries --> <dependency> @@ -114,6 +114,13 @@ under the License. <scope>test</scope> </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.16.20</version> + <scope>test</scope> + </dependency> + </dependencies> <build> http://git-wip-us.apache.org/repos/asf/flink/blob/5ac96c7c/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeExtractionTest.java ---------------------------------------------------------------------- diff --git a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeExtractionTest.java b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeExtractionTest.java index 54127be..a2a3bec 100644 --- a/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeExtractionTest.java +++ b/flink-core/src/test/java/org/apache/flink/api/java/typeutils/PojoTypeExtractionTest.java @@ -31,6 +31,9 @@ import org.apache.flink.core.memory.DataInputView; import org.apache.flink.core.memory.DataOutputView; import org.apache.flink.types.Value; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; import org.junit.Assert; import org.junit.Test; @@ -877,4 +880,24 @@ public class PojoTypeExtractionTest { Assert.assertEquals(GenericTypeInfo.class, ((PojoTypeInfo) pti).getPojoFieldAt(0).getTypeInformation().getClass()); } + /** + * POJO generated using Lombok. + */ + @Getter + @Setter + @NoArgsConstructor + public static class TestLombok{ + private int age = 10; + private String name; + } + + @Test + public void testLombokPojo() { + TypeInformation<TestLombok> ti = TypeExtractor.getForClass(TestLombok.class); + Assert.assertTrue(ti instanceof PojoTypeInfo); + + PojoTypeInfo<TestLombok> pti = (PojoTypeInfo<TestLombok>) ti; + Assert.assertEquals(BasicTypeInfo.INT_TYPE_INFO, pti.getTypeAt(0)); + Assert.assertEquals(BasicTypeInfo.STRING_TYPE_INFO, pti.getTypeAt(1)); + } }
