This is an automated email from the ASF dual-hosted git repository.
chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 492f763 [FLINK-11907][types] Normalize String/BigInteger in
GenericTypeInfoTest
492f763 is described below
commit 492f763e419e55bdfe4054676bda6e3fa74a8971
Author: Chesnay Schepler <[email protected]>
AuthorDate: Fri Mar 22 14:28:43 2019 +0100
[FLINK-11907][types] Normalize String/BigInteger in GenericTypeInfoTest
---
.../flink/test/misc/GenericTypeInfoTest.java | 36 ++++++++--------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git
a/flink-tests/src/test/java/org/apache/flink/test/misc/GenericTypeInfoTest.java
b/flink-tests/src/test/java/org/apache/flink/test/misc/GenericTypeInfoTest.java
index 6922689..b219d42 100644
---
a/flink-tests/src/test/java/org/apache/flink/test/misc/GenericTypeInfoTest.java
+++
b/flink-tests/src/test/java/org/apache/flink/test/misc/GenericTypeInfoTest.java
@@ -26,7 +26,7 @@ import
org.apache.flink.test.operators.util.CollectionDataSets;
import org.junit.Assert;
import org.junit.Test;
-import static org.hamcrest.core.StringStartsWith.startsWith;
+import static org.hamcrest.core.IsEqual.equalTo;
/**
* Test TypeInfo serializer tree.
@@ -40,39 +40,27 @@ public class GenericTypeInfoTest {
(TypeInformation<CollectionDataSets.PojoWithCollectionGeneric>)
TypeExtractor.createTypeInfo(CollectionDataSets.PojoWithCollectionGeneric.class);
- String serTree = Utils.getSerializerTree(ti);
- // We can not test against the entire output because the fields
of 'String' differ
- // between java versions
- Assert.assertThat(serTree, startsWith("GenericTypeInfo
(PojoWithCollectionGeneric)\n" +
+ final String serTree = Utils.getSerializerTree(ti)
+ // normalize String/BigInteger representations as they
vary across java versions
+ // do 2 passes for BigInteger since they occur at
different indentations
+ .replaceAll("(java\\.lang\\.String\\R)( {12}\\S*\\R)+",
"$1")
+ .replaceAll("(
{4}[a-zA-Z]+:java\\.math\\.BigInteger\\R)( {8}\\S*\\R)+", "$1")
+ .replaceAll("(
{8}[a-zA-Z]+:java\\.math\\.BigInteger\\R)( {12}\\S*\\R)+", "$1");
+
+ Assert.assertThat(serTree, equalTo("GenericTypeInfo
(PojoWithCollectionGeneric)\n" +
" pojos:java.util.List\n" +
" key:int\n" +
" sqlDate:java.sql.Date\n" +
" bigInt:java.math.BigInteger\n" +
- " signum:int\n" +
- " mag:[I\n" +
- " bitCount:int\n" +
- " bitLength:int\n" +
- " lowestSetBit:int\n" +
- " firstNonzeroIntNum:int\n" +
"
bigDecimalKeepItNull:java.math.BigDecimal\n" +
" intVal:java.math.BigInteger\n" +
- " signum:int\n" +
- " mag:[I\n" +
- " bitCount:int\n" +
- " bitLength:int\n" +
- " lowestSetBit:int\n" +
- " firstNonzeroIntNum:int\n" +
" scale:int\n" +
" scalaBigInt:scala.math.BigInt\n" +
" bigInteger:java.math.BigInteger\n" +
- " signum:int\n" +
- " mag:[I\n" +
- " bitCount:int\n" +
- " bitLength:int\n" +
- " lowestSetBit:int\n" +
- " firstNonzeroIntNum:int\n" +
" mixed:java.util.List\n" +
"
makeMeGeneric:org.apache.flink.test.operators.util.CollectionDataSets$PojoWithDateAndEnum\n"
+
- " group:java.lang.String\n"));
+ " group:java.lang.String\n" +
+ " date:java.util.Date\n" +
+ "
cat:org.apache.flink.test.operators.util.CollectionDataSets$Category (is
enum)\n"));
}
}