You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/02/25 03:05:19 UTC

[incubator-plc4x] 06/06: test a few bad paths

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

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

commit 63c8064acc6867046bae1144cf7d6d9711cb6e96
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:05:05 2018 +1100

    test a few bad paths
---
 .../java/ads/api/generic/types/DataLengthTest.java     | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
index a867031..6992585 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/DataLengthTest.java
@@ -30,9 +30,23 @@ public class DataLengthTest {
     private final byte NULL_BYTE = 0x0;
 
     @Test
-    public void ofBytes() {
+    public void ofBytesJustRight() {
         assertEquals("0", DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE).toString());
-        assertThrows(IllegalArgumentException.class, () -> DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void ofBytesTooMany() {
+        DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE, NULL_BYTE);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void ofBytesTooFew() {
+        DataLength.of(NULL_BYTE, NULL_BYTE, NULL_BYTE);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void ofBytesNone() {
+        DataLength.of();
     }
 
     @Test

-- 
To stop receiving notification emails like this one, please contact
jmclean@apache.org.