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/17 18:32:36 UTC
[plc4x] branch feature/complex-types updated: [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 feature/complex-types
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/complex-types by this push:
new 5945689 [plc4j-api] added basic test for plc values
5945689 is described below
commit 59456899f1711e6b39834be3c06fd8a186b4625f
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