You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2019/12/18 10:41:09 UTC

[plc4x] 05/05: [plc4j-api] added basic test for plc values

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

sruehl pushed a commit to branch next-gen-core
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 5c56151ed552a775b34a1184f1baf51d556949cf
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Tue Dec 17 19:30:27 2019 +0100

    [plc4j-api] added basic test for plc values
---
 .../apache/plc4x/java/api/value/PlcValuesTest.java | 31 +++++++++++++++++-----
 1 file changed, 25 insertions(+), 6 deletions(-)

diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/value/PlcValuesTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/value/PlcValuesTest.java
index 6f315b5..1d2355a 100644
--- a/plc4j/api/src/test/java/org/apache/plc4x/java/api/value/PlcValuesTest.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/value/PlcValuesTest.java
@@ -19,15 +19,34 @@
 
 package org.apache.plc4x.java.api.value;
 
-import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
 
-import static org.junit.jupiter.api.Assertions.*;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
 
 class PlcValuesTest {
 
-    @Test
-    void testInstance() {
-        Object o = "Hallo";
-        PlcValues.of(o);
+    @ParameterizedTest
+    @MethodSource("values")
+    void builders(Class<?> clazz, List<Object> values) throws Exception {
+        Method declaredMethod = PlcValues.class.getDeclaredMethod("of", clazz);
+        for (Object value : values) {
+            Object invoke = declaredMethod.invoke(null, value);
+            assertNotNull(invoke);
+        }
+    }
+
+    private static Object[][] values() {
+        return new Object[][]{
+            {String.class, Arrays.asList("test", "test2")},
+            {Integer.class, Arrays.asList(1, 2, 3, 4)},
+            {int.class, Arrays.asList(1, 1)},
+            {Boolean.class, Arrays.asList(true, false)},
+            {boolean.class, Arrays.asList(true, false)},
+        };
     }
 }
\ No newline at end of file