You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2018/11/06 10:14:29 UTC

[incubator-plc4x] branch master updated: - Added the missing test-coverage to the API module (With some admitably stupid tests)

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

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new bd88b3a  - Added the missing test-coverage to the API module (With some admitably stupid tests)
bd88b3a is described below

commit bd88b3a396535a4606b961fc43350065e72c1d6c
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Nov 6 11:14:16 2018 +0100

    - Added the missing test-coverage to the API module (With some admitably stupid tests)
---
 plc4j/api/pom.xml                                  |  7 +++
 .../api/exceptions/PlcNotImplementedException.java |  2 +
 .../plc4x/java/api/types/PlcResponseCode.java      |  2 +
 .../PlcUsernamePasswordAuthenticationTest.java     | 21 +++++++-
 .../api/exceptions/PlcConnectionExceptionTest.java | 56 +++++++++++++++++++
 .../java/api/exceptions/PlcExceptionTest.java      | 56 +++++++++++++++++++
 .../PlcIncompatibleDatatypeExceptionTest.java}     | 23 +++++---
 .../exceptions/PlcInvalidFieldExceptionTest.java   | 51 ++++++++++++++++++
 .../java/api/exceptions/PlcIoExceptionTest.java    | 56 +++++++++++++++++++
 .../PlcNotImplementedExceptionTest.java}           | 23 +++++---
 .../api/exceptions/PlcProtocolExceptionTest.java   | 56 +++++++++++++++++++
 .../PlcProtocolPayloadTooBigExceptionTest.java     | 42 +++++++++++++++
 .../api/exceptions/PlcRuntimeExceptionTest.java    | 56 +++++++++++++++++++
 .../api/exceptions/PlcTimeoutExceptionTest.java}   | 27 +++++++---
 .../PlcUnsupportedDataTypeExceptionTest.java       | 63 ++++++++++++++++++++++
 .../PlcUnsupportedOperationExceptionTest.java}     | 23 +++++---
 .../java/api/types/PlcClientDatatypeTest.java      | 46 ++++++++++++++++
 .../plc4x/java/api/types/PlcResponseCodeTest.java} | 29 ++++++----
 .../java/api/types/PlcSubscriptionTypeTest.java}   | 26 +++++----
 19 files changed, 614 insertions(+), 51 deletions(-)

diff --git a/plc4j/api/pom.xml b/plc4j/api/pom.xml
index c31e794..9522371 100644
--- a/plc4j/api/pom.xml
+++ b/plc4j/api/pom.xml
@@ -38,6 +38,13 @@
       <version>0.2.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>nl.jqno.equalsverifier</groupId>
+      <artifactId>equalsverifier</artifactId>
+      <version>3.0.2</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
 </project>
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
index 04e2fe3..1eea2b0 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
@@ -22,7 +22,9 @@ package org.apache.plc4x.java.api.exceptions;
  * indicates that a functionality is not implemented yet.
  */
 public class PlcNotImplementedException extends PlcRuntimeException {
+
     public PlcNotImplementedException(String message) {
         super(message);
     }
+
 }
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/types/PlcResponseCode.java b/plc4j/api/src/main/java/org/apache/plc4x/java/api/types/PlcResponseCode.java
index 6ddcbdd..b72018f 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/types/PlcResponseCode.java
+++ b/plc4j/api/src/main/java/org/apache/plc4x/java/api/types/PlcResponseCode.java
@@ -19,10 +19,12 @@ under the License.
 package org.apache.plc4x.java.api.types;
 
 public enum PlcResponseCode {
+
     OK,
     NOT_FOUND,
     INVALID_ADDRESS,
     INVALID_DATATYPE,
     INTERNAL_ERROR,
     RESPONSE_PENDING
+
 }
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthenticationTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthenticationTest.java
index 29cd00d..1932932 100644
--- a/plc4j/api/src/test/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthenticationTest.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/authentication/PlcUsernamePasswordAuthenticationTest.java
@@ -19,7 +19,9 @@ under the License.
 package org.apache.plc4x.java.api.authentication;
 
 
+import nl.jqno.equalsverifier.EqualsVerifier;
 import org.apache.plc4x.test.FastTests;
+import org.hamcrest.Matchers;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
@@ -30,11 +32,28 @@ public class PlcUsernamePasswordAuthenticationTest {
 
     @Test
     @Category(FastTests.class)
-    public void authenication() {
+    public void authentication() {
         PlcUsernamePasswordAuthentication authenication = new PlcUsernamePasswordAuthentication("user", "password");
 
         assertThat("Unexpected user name", authenication.getUsername(), equalTo("user"));
         assertThat("Unexpected password", authenication.getPassword(), equalTo("password"));
     }
 
+    /**
+     * Usually in a toString method most properties are output.
+     * However the password field should never be output this way or the password could be leaked to a log-file
+     * unintentionally.
+     */
+    @Test
+   public void toStringDoesntLeakPassword() {
+        PlcUsernamePasswordAuthentication authenication = new PlcUsernamePasswordAuthentication("user", "top-secret");
+
+        assertThat(authenication.toString(), Matchers.not(Matchers.containsString("top-secret")));
+    }
+
+    @Test
+    public void equalsContract() {
+        EqualsVerifier.forClass(PlcUsernamePasswordAuthentication.class).usingGetClass().verify();
+    }
+
 }
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcConnectionExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcConnectionExceptionTest.java
new file mode 100644
index 0000000..61340ee
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcConnectionExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcConnectionExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcConnectionException.class, () -> {
+            throw new PlcConnectionException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcConnectionException.class, () -> {
+            throw new PlcConnectionException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcConnectionException.class, () -> {
+            throw new PlcConnectionException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcConnectionException.class, () -> {
+            throw new PlcConnectionException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcExceptionTest.java
new file mode 100644
index 0000000..1acf90a
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcException.class, () -> {
+            throw new PlcException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcException.class, () -> {
+            throw new PlcException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcException.class, () -> {
+            throw new PlcException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcException.class, () -> {
+            throw new PlcException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIncompatibleDatatypeExceptionTest.java
similarity index 66%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIncompatibleDatatypeExceptionTest.java
index 04e2fe3..07fefdb 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIncompatibleDatatypeExceptionTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,20 @@
  specific language governing permissions and limitations
  under the License.
  */
+
 package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcIncompatibleDatatypeExceptionTest {
+
+    @Test
+    public void constructor() {
+        assertThrows(PlcIncompatibleDatatypeException.class, () -> {
+            throw new PlcIncompatibleDatatypeException("Foo".getClass(), 42);
+        });
     }
-}
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcInvalidFieldExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcInvalidFieldExceptionTest.java
new file mode 100644
index 0000000..bfbf4ae
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcInvalidFieldExceptionTest.java
@@ -0,0 +1,51 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.regex.Pattern;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcInvalidFieldExceptionTest {
+
+    @Test
+    public void simpleFieldStringConstructor() {
+        assertThrows(PlcInvalidFieldException.class, () -> {
+            throw new PlcInvalidFieldException("Pattern");
+        });
+    }
+
+    @Test
+    public void simpleFieldStringAndPatternConstructor() {
+        assertThrows(PlcInvalidFieldException.class, () -> {
+            throw new PlcInvalidFieldException("Pattern", Pattern.compile("foo"));
+        });
+    }
+
+    @Test
+    public void simpleFieldStringPatternAndReadableStringConstructor() {
+        assertThrows(PlcInvalidFieldException.class, () -> {
+            throw new PlcInvalidFieldException("Pattern", Pattern.compile("foo"), "readable");
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIoExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIoExceptionTest.java
new file mode 100644
index 0000000..8a77b0e
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcIoExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcIoExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcIoException.class,() -> {
+            throw new PlcIoException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcIoException.class,() -> {
+            throw new PlcIoException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcIoException.class,() -> {
+            throw new PlcIoException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcIoException.class,() -> {
+            throw new PlcIoException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedExceptionTest.java
similarity index 67%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedExceptionTest.java
index 04e2fe3..278b2f4 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedExceptionTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,20 @@
  specific language governing permissions and limitations
  under the License.
  */
+
 package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcNotImplementedExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcNotImplementedException.class,() -> {
+            throw new PlcNotImplementedException("Foo");
+        });
     }
-}
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolExceptionTest.java
new file mode 100644
index 0000000..6e97b04
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcProtocolExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcProtocolException.class,() -> {
+            throw new PlcProtocolException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcProtocolException.class,() -> {
+            throw new PlcProtocolException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcProtocolException.class,() -> {
+            throw new PlcProtocolException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcProtocolException.class,() -> {
+            throw new PlcProtocolException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolPayloadTooBigExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolPayloadTooBigExceptionTest.java
new file mode 100644
index 0000000..2e3200a
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcProtocolPayloadTooBigExceptionTest.java
@@ -0,0 +1,42 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcProtocolPayloadTooBigExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        PlcProtocolPayloadTooBigException exception = assertThrows(PlcProtocolPayloadTooBigException. class,() -> {
+            throw new PlcProtocolPayloadTooBigException("protocolName", 1024, 1040, "payload");
+        });
+
+        assertThat(exception.getProtocolName(), equalTo("protocolName"));
+        assertThat(exception.getMaxSize(), equalTo(1024));
+        assertThat(exception.getActualSize(), equalTo(1040));
+        assertThat(exception.getPayload(), equalTo("payload"));
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcRuntimeExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcRuntimeExceptionTest.java
new file mode 100644
index 0000000..8985c52
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcRuntimeExceptionTest.java
@@ -0,0 +1,56 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcRuntimeExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcRuntimeException.class,() -> {
+            throw new PlcRuntimeException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcRuntimeException.class,() -> {
+            throw new PlcRuntimeException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcRuntimeException.class,() -> {
+            throw new PlcRuntimeException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcRuntimeException.class,() -> {
+            throw new PlcRuntimeException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcTimeoutExceptionTest.java
similarity index 58%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcTimeoutExceptionTest.java
index 04e2fe3..344f7f9 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcTimeoutExceptionTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,24 @@
  specific language governing permissions and limitations
  under the License.
  */
+
 package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcTimeoutExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        PlcTimeoutException exception = assertThrows(PlcTimeoutException.class,() -> {
+            throw new PlcTimeoutException(1024L);
+        });
+
+        assertThat(exception.getTimeout(), equalTo(1024L));
     }
-}
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedDataTypeExceptionTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedDataTypeExceptionTest.java
new file mode 100644
index 0000000..cf46fc4
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedDataTypeExceptionTest.java
@@ -0,0 +1,63 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.exceptions;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcUnsupportedDataTypeExceptionTest {
+
+    @Test
+    public void simpleTypeConstructor() {
+        assertThrows(PlcUnsupportedDataTypeException.class,() -> {
+            throw new PlcUnsupportedDataTypeException(Long.class);
+        });
+    }
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcUnsupportedDataTypeException.class,() -> {
+            throw new PlcUnsupportedDataTypeException("Foo");
+        });
+    }
+
+    @Test
+    public void simpleThrowableConstructor() {
+        assertThrows(PlcUnsupportedDataTypeException.class,() -> {
+            throw new PlcUnsupportedDataTypeException(new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void simpleStringAndThrowableConstructor() {
+        assertThrows(PlcUnsupportedDataTypeException.class,() -> {
+            throw new PlcUnsupportedDataTypeException("foo", new IllegalArgumentException("bar"));
+        });
+    }
+
+    @Test
+    public void complexStringAndThrowableConstructor() {
+        assertThrows(PlcUnsupportedDataTypeException.class,() -> {
+            throw new PlcUnsupportedDataTypeException("foo", new IllegalArgumentException("bar"), false, false);
+        });
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedOperationExceptionTest.java
similarity index 66%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedOperationExceptionTest.java
index 04e2fe3..58f7b72 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/exceptions/PlcUnsupportedOperationExceptionTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,20 @@
  specific language governing permissions and limitations
  under the License.
  */
+
 package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+class PlcUnsupportedOperationExceptionTest {
+
+    @Test
+    public void simpleStringConstructor() {
+        assertThrows(PlcUnsupportedOperationException.class, () -> {
+            throw new PlcUnsupportedOperationException("Foo");
+        });
     }
-}
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcClientDatatypeTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcClientDatatypeTest.java
new file mode 100644
index 0000000..2d8c976
--- /dev/null
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcClientDatatypeTest.java
@@ -0,0 +1,46 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.api.types;
+
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+
+
+class PlcClientDatatypeTest {
+
+    @Test
+    public void testConstants() {
+        assertThat(PlcClientDatatype.BOOLEAN, notNullValue());
+        assertThat(PlcClientDatatype.BYTE, notNullValue());
+        assertThat(PlcClientDatatype.SHORT, notNullValue());
+        assertThat(PlcClientDatatype.INTEGER, notNullValue());
+        assertThat(PlcClientDatatype.LONG, notNullValue());
+        assertThat(PlcClientDatatype.FLOAT, notNullValue());
+        assertThat(PlcClientDatatype.DOUBLE, notNullValue());
+        assertThat(PlcClientDatatype.STRING, notNullValue());
+        assertThat(PlcClientDatatype.TIME, notNullValue());
+        assertThat(PlcClientDatatype.DATE, notNullValue());
+        assertThat(PlcClientDatatype.DATE_TIME, notNullValue());
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcResponseCodeTest.java
similarity index 51%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcResponseCodeTest.java
index 04e2fe3..304ae15 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcResponseCodeTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,24 @@
  specific language governing permissions and limitations
  under the License.
  */
-package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+package org.apache.plc4x.java.api.types;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+
+class PlcResponseCodeTest {
+
+    @Test
+    public void testConstants() {
+        assertThat(PlcResponseCode.OK, notNullValue());
+        assertThat(PlcResponseCode.INTERNAL_ERROR, notNullValue());
+        assertThat(PlcResponseCode.NOT_FOUND, notNullValue());
+        assertThat(PlcResponseCode.INVALID_ADDRESS, notNullValue());
+        assertThat(PlcResponseCode.INVALID_DATATYPE, notNullValue());
+        assertThat(PlcResponseCode.RESPONSE_PENDING, notNullValue());
     }
-}
+
+}
\ No newline at end of file
diff --git a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcSubscriptionTypeTest.java
similarity index 59%
copy from plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
copy to plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcSubscriptionTypeTest.java
index 04e2fe3..b33f832 100644
--- a/plc4j/api/src/main/java/org/apache/plc4x/java/api/exceptions/PlcNotImplementedException.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/types/PlcSubscriptionTypeTest.java
@@ -7,7 +7,7 @@
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
-   http://www.apache.org/licenses/LICENSE-2.0
+     http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
@@ -16,13 +16,21 @@
  specific language governing permissions and limitations
  under the License.
  */
-package org.apache.plc4x.java.api.exceptions;
 
-/**
- * indicates that a functionality is not implemented yet.
- */
-public class PlcNotImplementedException extends PlcRuntimeException {
-    public PlcNotImplementedException(String message) {
-        super(message);
+package org.apache.plc4x.java.api.types;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+
+class PlcSubscriptionTypeTest {
+
+    @Test
+    public void testConstants() {
+        assertThat(PlcSubscriptionType.CHANGE_OF_STATE, notNullValue());
+        assertThat(PlcSubscriptionType.CYCLIC, notNullValue());
+        assertThat(PlcSubscriptionType.EVENT, notNullValue());
     }
-}
+
+}
\ No newline at end of file