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 eb07a1ba4a7ebc2e422cb52563000651cda42a8f
Author: Justin Mclean <jmcl...@apache.org>
AuthorDate: Sun Jan 14 10:00:35 2018 +1100

    add a couple of bad path tests for unsupported tpdu codes
---
 .../plc4x/java/isotp/netty/IsoTPProtocolTest.java  | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocolTest.java
 
b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocolTest.java
index 6808b0d..fea612a 100644
--- 
a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocolTest.java
+++ 
b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/isotp/netty/IsoTPProtocolTest.java
@@ -453,6 +453,28 @@ public class IsoTPProtocolTest {
 
     @Test
     @Tag("fast")
+    public void encodeUnsupported() throws Exception {
+        ArrayList<Parameter> parmameters = new ArrayList<>();
+        CustomTpdu tpdu = new CustomTpdu((byte)0x7F, parmameters, buf);
+
+        isoTPProtocol.encode(ctx, tpdu, out);
+        assertTrue(out.size() == 0, "Message encoded when unsupported Tpdu 
code passed");
+   }
+
+
+    @Test
+    @Tag("fast")
+    public void decodeUnsupported() throws Exception {
+        IsoOnTcpMessage in = new IsoOnTcpMessage(buf);
+        buf.writeByte(0x3) // header length
+            .writeByte(0x7F)
+            .writeShort(0x01); // destination reference
+        isoTPProtocol.decode(ctx, in, out);
+        assertTrue(out.size() == 0, "Message decoded when unsupported Tpdu 
code passed");
+    }
+
+    @Test
+    @Tag("fast")
     public void decodeCallingParameter() throws Exception {
         buf.writeByte(0x8) // header length
             .writeByte(TpduCode.TPDU_ERROR.getCode())

-- 
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <commits@plc4x.apache.org>.

Reply via email to