This is an automated email from the ASF dual-hosted git repository. pnowojski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit dfbf32ba66730388110316fe10e48edf28c83214 Author: Piotr Nowojski <[email protected]> AuthorDate: Thu Aug 16 14:20:51 2018 +0200 [hotfix][tests] Deduplicate code in ListCheckpointedTest --- .../api/checkpoint/ListCheckpointedTest.java | 23 +++++++--------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java index ff0b0fc..d6d7591 100644 --- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java +++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/api/checkpoint/ListCheckpointedTest.java @@ -37,31 +37,22 @@ public class ListCheckpointedTest { @Test public void testUDFReturningNull() throws Exception { - TestUserFunction userFunction = new TestUserFunction(null); - AbstractStreamOperatorTestHarness<Integer> testHarness = - new AbstractStreamOperatorTestHarness<>(new StreamMap<>(userFunction), 1, 1, 0); - testHarness.open(); - OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0L); - testHarness.initializeState(snapshot); - Assert.assertTrue(userFunction.isRestored()); + testUDF(new TestUserFunction(null)); } @Test public void testUDFReturningEmpty() throws Exception { - TestUserFunction userFunction = new TestUserFunction(Collections.<Integer>emptyList()); - AbstractStreamOperatorTestHarness<Integer> testHarness = - new AbstractStreamOperatorTestHarness<>(new StreamMap<>(userFunction), 1, 1, 0); - testHarness.open(); - OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0L); - testHarness.initializeState(snapshot); - Assert.assertTrue(userFunction.isRestored()); + testUDF(new TestUserFunction(Collections.<Integer>emptyList())); } @Test public void testUDFReturningData() throws Exception { - TestUserFunction userFunction = new TestUserFunction(Arrays.asList(1, 2, 3)); + testUDF(new TestUserFunction(Arrays.asList(1, 2, 3))); + } + + private static void testUDF(TestUserFunction userFunction) throws Exception { AbstractStreamOperatorTestHarness<Integer> testHarness = - new AbstractStreamOperatorTestHarness<>(new StreamMap<>(userFunction), 1, 1, 0); + new AbstractStreamOperatorTestHarness<>(new StreamMap<>(userFunction), 1, 1, 0); testHarness.open(); OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0L); testHarness.initializeState(snapshot);
