You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lc...@apache.org on 2018/11/30 18:41:06 UTC

[beam] branch master updated: Simplifying a few junit assertions (#7139)

This is an automated email from the ASF dual-hosted git repository.

lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new ad0cb4f  Simplifying a few junit assertions (#7139)
ad0cb4f is described below

commit ad0cb4ff7d9108d427387ad969ee61a55d88509f
Author: Colm O hEigeartaigh <co...@users.noreply.github.com>
AuthorDate: Fri Nov 30 18:40:57 2018 +0000

    Simplifying a few junit assertions (#7139)
---
 .../beam/runners/dataflow/worker/GroupingShuffleReaderTest.java      | 2 +-
 .../apache/beam/runners/dataflow/worker/IsmSideInputReaderTest.java  | 3 ++-
 .../dataflow/worker/graph/CloneAmbiguousFlattensFunctionTest.java    | 5 +++--
 .../src/test/java/org/apache/beam/sdk/util/gcsfs/GcsPathTest.java    | 3 ++-
 4 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReaderTest.java b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReaderTest.java
index 1d2d186..8eeeef0 100644
--- a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReaderTest.java
+++ b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/GroupingShuffleReaderTest.java
@@ -442,7 +442,7 @@ public class GroupingShuffleReaderTest {
   private void expectShuffleReadCounterEquals(
       TestShuffleReadCounterFactory factory, Map<String, Long> expectedReadBytesForOriginal) {
     ShuffleReadCounter src = factory.getOnlyShuffleReadCounterOrNull();
-    assertTrue(src != null);
+    assertNotNull(src);
     // If the experiment is enabled then the legacyPerOperationPerDatasetBytesCounter
     // should not be set.
     if (src.legacyPerOperationPerDatasetBytesCounter != null) {
diff --git a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/IsmSideInputReaderTest.java b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/IsmSideInputReaderTest.java
index 3edf08e..5ebe93a 100644
--- a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/IsmSideInputReaderTest.java
+++ b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/IsmSideInputReaderTest.java
@@ -26,6 +26,7 @@ import static org.hamcrest.Matchers.empty;
 import static org.hamcrest.Matchers.hasItem;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
@@ -1392,7 +1393,7 @@ public class IsmSideInputReaderTest {
           executionContext.getExecutionStateRegistry().extractUpdates(true);
       assertThat(counterUpdates, hasItem(expectedSideInputMsecUpdate));
       Counter<?, ?> expectedCounter = counterFactory.getExistingCounter(expectedCounterName);
-      assertTrue(expectedCounter != null);
+      assertNotNull(expectedCounter);
     }
   }
 
diff --git a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/graph/CloneAmbiguousFlattensFunctionTest.java b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/graph/CloneAmbiguousFlattensFunctionTest.java
index 2b87995..b74a287 100644
--- a/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/graph/CloneAmbiguousFlattensFunctionTest.java
+++ b/runners/google-cloud-dataflow-java/worker/src/test/java/org/apache/beam/runners/dataflow/worker/graph/CloneAmbiguousFlattensFunctionTest.java
@@ -18,6 +18,7 @@
 package org.apache.beam.runners.dataflow.worker.graph;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
@@ -131,8 +132,8 @@ public final class CloneAmbiguousFlattensFunctionTest {
         }
       }
     }
-    assertTrue("Ambiguous flatten was not cloned into sdk flatten.", sdkFlatten != null);
-    assertTrue("Ambiguous flatten was not cloned into runner flatten.", runnerFlatten != null);
+    assertNotNull("Ambiguous flatten was not cloned into sdk flatten.", sdkFlatten);
+    assertNotNull("Ambiguous flatten was not cloned into runner flatten.", runnerFlatten);
 
     Node sdkFlattenOutput = Iterables.getOnlyElement(network.successors(sdkFlatten));
     Node runnerFlattenOutput = Iterables.getOnlyElement(network.successors(runnerFlatten));
diff --git a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/gcsfs/GcsPathTest.java b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/gcsfs/GcsPathTest.java
index 3416a0e..19db9e8 100644
--- a/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/gcsfs/GcsPathTest.java
+++ b/sdks/java/extensions/google-cloud-platform-core/src/test/java/org/apache/beam/sdk/util/gcsfs/GcsPathTest.java
@@ -19,6 +19,7 @@ package org.apache.beam.sdk.util.gcsfs;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
@@ -196,7 +197,7 @@ public class GcsPathTest {
     assertEquals(b2, b);
 
     assertThat(a, Matchers.not(Matchers.equalTo(Paths.get("/tmp/foo"))));
-    assertTrue(a != null);
+    assertNotNull(a);
   }
 
   @Test(expected = IllegalArgumentException.class)