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:13 UTC

[incubator-plc4x] branch master updated (93d03b4 -> 63c8064)

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

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


    from 93d03b4  Disabled the RawSocketTest as we need to find a way to run tests in Docker
     new d4d000a  no need for cast
     new bd61054  fix speling
     new d95e2e9  no need for extra brackets
     new bef900c  Next unit tests (some just for coverage)
     new e833764  test a few bad paths
     new 63c8064  test a few bad paths

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../plc4x/java/api/messages/APIMessageTests.java   |  2 +-
 .../plc4x/java/ads/api/generic/types/AMSNetId.java |  4 +-
 .../plc4x/java/ads/api/generic/types/Command.java  |  2 +-
 .../java/ads/netty/util/LittleEndianEncoder.java   |  8 +--
 .../java/ads/api/generic/types/AMSErrorTest.java   | 80 ++++++++++++++++++++++
 .../java/ads/api/generic/types/AMSNetIdTest.java   | 42 ++++++++++++
 .../java/ads/api/generic/types/AMSPortTest.java    | 10 +++
 .../java/ads/api/generic/types/CommandTest.java    | 39 +++++++++++
 .../java/ads/api/generic/types/DataLengthTest.java | 18 ++++-
 .../java/ads/api/generic/types/StateTest.java      | 41 +++++++++++
 .../plc4x/java/ads/model/ADSAddressTest.java       | 40 +++++++++++
 11 files changed, 276 insertions(+), 10 deletions(-)
 create mode 100644 plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSErrorTest.java
 create mode 100644 plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetIdTest.java
 create mode 100644 plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/CommandTest.java
 create mode 100644 plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/StateTest.java
 create mode 100644 plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/model/ADSAddressTest.java

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

[incubator-plc4x] 04/06: Next unit tests (some just for coverage)

Posted by jm...@apache.org.
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 bef900c3d035b9170d57d35ba12a5a82f60d92aa
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:04:22 2018 +1100

    Next unit tests (some just for coverage)
---
 .../java/ads/api/generic/types/AMSErrorTest.java   | 80 ++++++++++++++++++++++
 .../java/ads/api/generic/types/AMSNetIdTest.java   | 42 ++++++++++++
 .../java/ads/api/generic/types/CommandTest.java    | 39 +++++++++++
 .../java/ads/api/generic/types/StateTest.java      | 41 +++++++++++
 .../plc4x/java/ads/model/ADSAddressTest.java       | 40 +++++++++++
 5 files changed, 242 insertions(+)

diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSErrorTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSErrorTest.java
new file mode 100644
index 0000000..0e08d4e
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSErrorTest.java
@@ -0,0 +1,80 @@
+package org.apache.plc4x.java.ads.api.generic.types;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.*;
+
+public class AMSErrorTest {
+
+    @Test
+    public void errorBytes() {
+        // note bytes in reverse order
+        AMSError error = AMSError.of((byte)0x01, (byte)0x20, (byte)0x00, (byte)0x00);
+        assertThat(error.getAsLong(), is(0x2001L));
+    }
+
+    @Test
+    public void errorLong() {
+        AMSError error = AMSError.of(0xFF02L);
+        assertThat(error.getAsLong(), is(0xFF02L));
+    }
+
+    @Test
+    public void errorLongBig() {
+        AMSError error = AMSError.of(0xFFFFFFFFL);
+        assertThat(error.getAsLong(), is(0xFFFFFFFFL));
+    }
+    
+    @Test
+    public void errorString() {
+        AMSError error = AMSError.of("255");
+        assertThat(error.getAsLong(), is(0xFFL));
+    }
+
+    @Test
+    public void errorByteBuf() {
+        ByteBuf buffer = Unpooled.buffer();
+
+        // note bytes in reverse order
+        buffer.writeByte((byte)0x04);
+        buffer.writeByte((byte)0x01);
+        buffer.writeByte((byte)0x00);
+        buffer.writeByte((byte)0x00);
+
+        AMSError error = AMSError.of(buffer);
+        assertThat(error.getAsLong(), is(260L));
+    }
+
+    @Test(expected = NumberFormatException.class)
+    public void noHex() {
+        AMSError error = AMSError.of("0xFF000000");
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void errorLongTooBig() {
+        AMSError error = AMSError.of(0x100000000L);
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void errorNegative() {
+        AMSError error = AMSError.of(-1);
+    }
+    
+    @Test
+    public void equals() {
+        AMSError a = AMSError.of((byte) 0x1, (byte) 0x2, (byte) 0x3, (byte) 0x4);
+        AMSError b = AMSError.of((byte) 0x1, (byte) 0x2, (byte) 0x3, (byte) 0x4);
+        AMSError c = AMSError.of((byte) 0x1, (byte) 0x2, (byte) 0x3, (byte) 0xFF);
+        byte array[] = {(byte) 0x1, (byte) 0x2, (byte) 0x3, (byte) 0x4};
+
+        assertThat(a.equals(a), is(true));
+        assertThat(a.equals(b), is(true));
+        assertThat(a.equals(c), is(false));
+        assertThat(a.equals(1), is(false));
+        assertThat(a.equals((byte) 1), is(false));
+        assertThat(a.equals(array), is(false));
+    }
+}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetIdTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetIdTest.java
new file mode 100644
index 0000000..0942c18
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetIdTest.java
@@ -0,0 +1,42 @@
+package org.apache.plc4x.java.ads.api.generic.types;
+
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.*;
+
+public class AMSNetIdTest {
+
+    @Test
+    public void netIdBytes() {
+        // note bytes in reverse order
+        AMSNetId netid = AMSNetId.of((byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04, (byte)0x05, (byte)0x06);
+        assertThat(netid.toString(), is("1.2.3.4.5.6"));
+    }
+
+    @Test
+    public void netIdString() {
+        // note bytes in reverse order
+        AMSNetId netid = AMSNetId.of("1.2.3.4.5.6");
+        assertThat(netid.toString(), is("1.2.3.4.5.6"));
+    }
+    
+    @Test(expected = IllegalArgumentException.class)
+    public void netIdTooShort() {
+        // note bytes in reverse order
+        AMSNetId netid = AMSNetId.of("1.2.3.4");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void netIdStringTooLong() {
+        // note bytes in reverse order
+        AMSNetId netid = AMSNetId.of("1.2.3.4.5.6.7.8");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void netIdStringWrongSeperator() {
+        // note bytes in reverse order
+        AMSNetId netid = AMSNetId.of("1:2:3:4:5:6");
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/CommandTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/CommandTest.java
new file mode 100644
index 0000000..d8b5a8e
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/CommandTest.java
@@ -0,0 +1,39 @@
+package org.apache.plc4x.java.ads.api.generic.types;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.*;
+
+public class CommandTest {
+
+    @Test
+    public void getBytes() {
+        byte[] result = {(byte)0x01, (byte)0x00};
+        Command command = Command.ofInt("1");
+        assertThat(command.getBytes(), is(result));
+    }
+
+    @Test
+    public void getByteBuf() {
+        ByteBuf result = Unpooled.buffer();
+        result.writeByte(0x02);
+        result.writeByte(0x00);
+        Command command = Command.ofInt("2");
+        assertThat(command.getByteBuf(), is(result));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void getBytesUnknown() {
+        Command command = Command.UNKNOWN;
+        command.getBytes();
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void getByteBufUnknown() {
+        Command command = Command.UNKNOWN;
+        command.getByteBuf();
+    }
+}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/StateTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/StateTest.java
new file mode 100644
index 0000000..ebe5ae4
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/StateTest.java
@@ -0,0 +1,41 @@
+package org.apache.plc4x.java.ads.api.generic.types;
+
+import org.junit.Test;
+
+import java.util.EnumSet;
+
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.isEmptyString;
+import static org.hamcrest.Matchers.not;
+import static org.junit.Assert.*;
+
+public class StateTest {
+
+    // Not the best unit tests but here for coverage
+
+    @Test
+    public void stateBitFields() {
+        int bitMask = State.StateMask.RESPONSE.getMask() | State.StateMask.NO_RETURN.getMask() | State.StateMask.ADS_COMMAND.getMask()
+                        | State.StateMask.SYSTEM_COMMAND.getMask() | State.StateMask.HIGH_PRIORITY_COMMAND.getMask() | State.StateMask.TIMESTAMP_ADDED.getMask()
+                        | State.StateMask.UDP_COMMAND.getMask() | State.StateMask.INIT_COMMAND.getMask() | State.StateMask.BROADCAST.getMask();
+        State state = State.of(bitMask);
+
+        assertThat(state.toString(), not((isEmptyString())));
+    }
+
+    @Test
+    public void equals() {
+        State a = State.of((byte) 0x1, (byte) 0x2);
+        State b = State.of((byte) 0x1, (byte) 0x2);
+        State c = State.of((byte) 0x1, (byte) 0x4);
+        byte array[] = {(byte) 0x1, (byte) 0x2};
+
+        assertThat(a.equals(a), is(true));
+        assertThat(a.equals(b), is(true));
+        assertThat(a.equals(c), is(false));
+        assertThat(a.equals(1), is(false));
+        assertThat(a.equals((byte) 1), is(false));
+        assertThat(a.equals(array), is(false));
+    }
+
+}
\ No newline at end of file
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/model/ADSAddressTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/model/ADSAddressTest.java
new file mode 100644
index 0000000..67970f2
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/model/ADSAddressTest.java
@@ -0,0 +1,40 @@
+package org.apache.plc4x.java.ads.model;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+
+public class ADSAddressTest {
+
+    @Test
+    public void of() {
+        ADSAddress address = ADSAddress.of("1/10");
+        assertThat(address.getIndexGroup(), is(1L));
+        assertThat(address.getIndexOffset(), is(10L));
+    }
+
+    @Test(expected  = IllegalArgumentException.class)
+    public void stringInAddress() {
+        ADSAddress address = ADSAddress.of("group/offset");
+    }
+
+    @Test(expected  = IllegalArgumentException.class)
+    public void singleNumberAddress() {
+        ADSAddress address = ADSAddress.of("10");
+    }
+
+    @Test(expected  = IllegalArgumentException.class)
+    public void wrongSeperator() {
+        ADSAddress address = ADSAddress.of("1:10");
+    }
+
+    @Test
+    public void getGroupAndOffset() {
+        ADSAddress address = ADSAddress.of(2L, 20L);
+        assertThat(address.getIndexGroup(), is(2L));
+        assertThat(address.getIndexOffset(), is(20L));
+    }
+}
\ No newline at end of file

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

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

Posted by jm...@apache.org.
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.

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

Posted by jm...@apache.org.
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 e833764bb7adfbfcb859de2e6e5cab76586feb7f
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:04:48 2018 +1100

    test a few bad paths
---
 .../apache/plc4x/java/ads/api/generic/types/AMSPortTest.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
index 7d1876f..5982419 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/generic/types/AMSPortTest.java
@@ -43,6 +43,16 @@ public class AMSPortTest {
         assertThrows(IllegalArgumentException.class, () -> AMSPort.of(65536));
     }
 
+    @Test(expected = IllegalArgumentException.class)
+    public void noStrings() {
+        AMSPort.of("port20");
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void noHex() {
+        AMSPort.of("0x0100");
+    }
+    
     @Test
     public void ofString() {
         assertByte(AMSPort.of("1"), "0x0100");

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

[incubator-plc4x] 01/06: no need for cast

Posted by jm...@apache.org.
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 d4d000af9c92bad5166bb68743269989f146b7c4
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:02:07 2018 +1100

    no need for cast
---
 .../test/java/org/apache/plc4x/java/api/messages/APIMessageTests.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/APIMessageTests.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/APIMessageTests.java
index e2811b1..2517409 100644
--- a/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/APIMessageTests.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/APIMessageTests.java
@@ -180,7 +180,7 @@ public class APIMessageTests {
         assertThat("Expected one request item", plcWriteRequest.getRequestItems(), hasSize(1));
         assertThat("Expected one request item", plcWriteRequest.getNumberOfItems(), equalTo(1));
         List values = plcWriteRequest.getRequestItems().get(0).getValues();
-        assertThat((byte) values.get(0), equalTo((byte) 0x33));
+        assertThat(values.get(0), equalTo((byte) 0x33));
     }
 
     @Test

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

[incubator-plc4x] 02/06: fix speling

Posted by jm...@apache.org.
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 bd6105489f6d46a57c5b6962d76427a354e88982
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:02:52 2018 +1100

    fix speling
---
 .../java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java    | 4 ++--
 .../java/org/apache/plc4x/java/ads/api/generic/types/Command.java     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
index c39a356..14df2e4 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/AMSNetId.java
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
 import java.util.stream.Stream;
 
 /**
- * The AMSNetId consists of 6 bytes and addresses the transmitter or receiver. One possible AMSNetId would be e.g.. 172.16.17.10.1.1. The storage arrangement in this example is as follows:
+ * The AMSNetId consists of 6 bytes and addresses the transmitter or receiver. One possible AMSNetId would be e.g. "172.16.17.10.1.1". The storage arrangement in this example is as follows:
  * <p>
  * _____0     1     2     3     4     5
  * __+-----------------------------------+
@@ -34,7 +34,7 @@ import java.util.stream.Stream;
  * __+-----------------------------------+
  * <p>
  * <p>
- * The AMSNetId is purely logical and has usually no relation to the IP address. The AMSNetId is configurated at the target system. At the PC for this the TwinCAT System Control is used. If you use other hardware, see the considering documentation for notes about settings of the AMS NetId.
+ * The AMSNetId is purely logical and has usually no relation to the IP address. The AMSNetId is configured at the target system. At the PC for this the TwinCAT System Control is used. If you use other hardware, see the considering documentation for notes about settings of the AMS NetId.
  */
 public class AMSNetId extends ByteValue {
 
diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
index f7ce3d1..d7ba4e0 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/api/generic/types/Command.java
@@ -51,7 +51,7 @@ public enum Command implements ByteReadable {
     final int intValue;
 
     Command() {
-        // Only used for unkown enum
+        // Only used for unknown enum
         value = new byte[0];
         intValue = 0;
     }

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

[incubator-plc4x] 03/06: no need for extra brackets

Posted by jm...@apache.org.
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 d95e2e9bb878246c40b601ac370d3d0ec029b535
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Sun Feb 25 14:03:19 2018 +1100

    no need for extra brackets
---
 .../org/apache/plc4x/java/ads/netty/util/LittleEndianEncoder.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianEncoder.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianEncoder.java
index 22d2dd1..20c84af 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianEncoder.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianEncoder.java
@@ -86,7 +86,7 @@ public class LittleEndianEncoder {
             // TODO: check how ads expects this data
             .map(Float::floatToIntBits)
             .map(intValue -> new byte[]{
-                (byte) ((intValue & 0x000000ff)),
+                (byte) (intValue & 0x000000ff),
                 (byte) ((intValue & 0x0000ff00) >> 8),
                 (byte) ((intValue & 0x00ff0000) >> 16),
                 (byte) ((intValue & 0xff000000) >> 24),
@@ -96,7 +96,7 @@ public class LittleEndianEncoder {
     public static Stream<byte[]> encodeInteger(Stream<Integer> integerStream) {
         return integerStream
             .map(intValue -> new byte[]{
-                (byte) ((intValue & 0x000000ff)),
+                (byte) (intValue & 0x000000ff),
                 (byte) ((intValue & 0x0000ff00) >> 8),
                 (byte) ((intValue & 0x00ff0000) >> 16),
                 (byte) ((intValue & 0xff000000) >> 24),
@@ -112,7 +112,7 @@ public class LittleEndianEncoder {
             .map(TimeStamp::javaToWinTime)
             .map(BigInteger::longValue)
             .map(time -> new byte[]{
-                (byte) ((time & 0x00000000_000000ffL)),
+                (byte) (time & 0x00000000_000000ffL),
                 (byte) ((time & 0x00000000_0000ff00L) >> 8),
                 (byte) ((time & 0x00000000_00ff0000L) >> 16),
                 (byte) ((time & 0x00000000_ff000000L) >> 24),
@@ -128,7 +128,7 @@ public class LittleEndianEncoder {
     public static Stream<byte[]> encodeShort(Stream<Short> shortStream) {
         return shortStream
             .map(shortValue -> new byte[]{
-                (byte) ((shortValue & 0x00ff)),
+                (byte) (shortValue & 0x00ff),
                 (byte) ((shortValue & 0xff00) >> 8),
             });
     }

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