nine03 commented on code in PR #2557:
URL: https://github.com/apache/streampipes/pull/2557#discussion_r1524660763


##########
streampipes-extensions/streampipes-processors-transformation-jvm/src/test/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/counter/TestBooleanCounterProcessor.java:
##########
@@ -46,50 +48,38 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Stream;
 
-import static org.junit.Assert.assertEquals;
-
-@RunWith(Parameterized.class)
 public class TestBooleanCounterProcessor {
   private static final Logger LOG = 
LoggerFactory.getLogger(TestBooleanCounterProcessor.class);
 
-  @org.junit.runners.Parameterized.Parameters
-  public static Iterable<Object[]> data() {
-    return Arrays.asList(new Object[][]{
-            {"Test", "BOTH", Arrays.asList(false, true), 1},
-            {"Test", "BOTH", Arrays.asList(false, true, false), 2},
-            {"Test", "BOTH", Arrays.asList(false), 0},
-            {"Test", "TRUE -> FALSE", Arrays.asList(false, true, false, false, 
true), 2},
-            {"Test", "TRUE -> FALSE", Arrays.asList(true, false), 1},
-            {"Test", "TRUE -> FALSE", Arrays.asList(false), 1},
-            {"Test", "FALSE -> TRUE", Arrays.asList(false), 0},
-            {"Test", "FALSE -> TRUE", Arrays.asList(false, false, true), 1},
-            {"Test", "FALSE -> TRUE", Arrays.asList(false, true, true, false), 
1},
-    });
+  static Stream<Arguments> data() {
+    return Stream.of(
+            Arguments.of("Test", "BOTH", Arrays.asList(false, true), 1),
+            Arguments.of("Test", "BOTH", Arrays.asList(false, true, false), 2),
+            Arguments.of("Test", "BOTH", Arrays.asList(false), 0),
+            Arguments.of("Test", "TRUE -> FALSE", Arrays.asList(false, true, 
false, false, true), 2),
+            Arguments.of("Test", "TRUE -> FALSE", Arrays.asList(true, false), 
1),
+            Arguments.of("Test", "TRUE -> FALSE", Arrays.asList(false), 1),
+            Arguments.of("Test", "FALSE -> TRUE", Arrays.asList(false), 0),
+            Arguments.of("Test", "FALSE -> TRUE", Arrays.asList(false, false, 
true), 1),
+            Arguments.of("Test", "FALSE -> TRUE", Arrays.asList(false, true, 
true, false), 1)
+    );
   }
 
-  @org.junit.runners.Parameterized.Parameter
-  public String invertFieldName;
-
-  /**
-   * Defines which boolean changes should be counted
-   * 0: BOTH
-   * 1: TRUE -> FALSE
-   * 2: FALSE -> TRUE
-   */
-  @org.junit.runners.Parameterized.Parameter(1)
-  public String flankUp;
-
-  @org.junit.runners.Parameterized.Parameter(2)
-  public List<Boolean> eventBooleans;
+  @ParameterizedTest
+  @MethodSource("data")
+  public void testBooleanCounter(
+          String invertFieldName,
+          String flankUp,
+          List<Boolean> eventBooleans,
+          Integer expectedBooleanCount
+  ){
 
-  @org.junit.runners.Parameterized.Parameter(3)
-  public Integer expectedBooleanCount;
-
-  @Test
-  public void testBooleanCounter() {
     BooleanCounterProcessor booleanCounter = new BooleanCounterProcessor();
-    DataProcessorDescription originalGraph = 
booleanCounter.declareConfig().getDescription();
+//    DataProcessorDescription originalGraph = 
booleanCounter.declareConfig().getDescription();

Review Comment:
   ```
   DataProcessorDescription originalGraph = 
booleanCounter.declareConfig().getDescription();
   ```
   
   Initially it was written like this, but after junit5 migration it didn't 
work.
   
   ```
   IDataProcessorConfiguration config = booleanCounter.declareConfig();
   DataProcessorDescription originalGraph = config.getDescription();
   ```
   
   and I got the error. 
   



##########
streampipes-extensions/streampipes-processors-transformation-jvm/src/test/java/org/apache/streampipes/processors/transformation/jvm/processor/booloperator/counter/TestBooleanCounterProcessor.java:
##########
@@ -132,15 +122,22 @@ public void disconnect() throws SpRuntimeException {}
     Integer counter = sendEvents(booleanCounter, spOut);
     LOG.info("Expected match count is {}", expectedBooleanCount);
     LOG.info("Actual match count is {}", counter);
-    assertEquals(expectedBooleanCount, counter);
+    Assertions.assertEquals(expectedBooleanCount, counter);
   }
 
-  private Integer sendEvents(BooleanCounterProcessor booleanCounter, 
SpOutputCollector spOut) {
+  /**
+   * Defines which boolean changes should be counted
+   * 0: BOTH
+   * 1: TRUE -> FALSE
+   * 2: FALSE -> TRUE
+   */
+
+  private Integer sendEvents(BooleanCounterProcessor booleanCounter, 
SpOutputCollector spOut, List<Boolean> eventBooleans, String invertFieldName) {
     int counter = 0;
-    List<Event> events = makeEvents();
+    List<Event> events = makeEvents(eventBooleans, invertFieldName);
     for (Event event : events) {
       LOG.info("Sending event with value "
-          + event.getFieldBySelector("s0::" + 
invertFieldName).getAsPrimitive().getAsBoolean());
+              + event.getFieldBySelector("s0::" + 
invertFieldName).getAsPrimitive().getAsBoolean());
       booleanCounter.onEvent(event, spOut);

Review Comment:
   There's an error in line 141.
   
   ```
   booleanCounter.onEvent(event, spOut);
   ```
   
   There's an error in spOut.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to