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 2018/05/30 13:11:20 UTC
[incubator-plc4x] 02/03: added simple test for digest util
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit d8568f4c35d2d7324b7f61b72f5a5f4251134e7e
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed May 30 11:35:16 2018 +0200
added simple test for digest util
---
.../apache/plc4x/java/ads/protocol/util/DigestUtilTest.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
index 7db07c4..e595779 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/protocol/util/DigestUtilTest.java
@@ -36,14 +36,21 @@ import static org.junit.Assert.assertEquals;
public class DigestUtilTest {
@Test
- public void sameCalculation() throws Exception {
+ public void sameCalculation() {
assertEquals(
DigestUtil.calculateCrc16(new byte[]{47, 99}),
DigestUtil.calculateCrc16(() -> Unpooled.wrappedBuffer(new byte[]{47}), () -> Unpooled.wrappedBuffer(new byte[]{99})));
}
@Test
- public void displayValue() throws Exception {
+ public void simpleUnwrap() {
+ assertEquals(
+ DigestUtil.calculateCrc16(new byte[]{47}),
+ DigestUtil.calculateCrc16(() -> Unpooled.wrappedBuffer(new byte[]{47})));
+ }
+
+ @Test
+ public void displayValue() {
Object[] crcs = IntStream.range(0, 256)
.map(value -> DigestUtil.calculateCrc16(new byte[]{(byte) value}))
.mapToObj(Integer::toHexString)
--
To stop receiving notification emails like this one, please contact
sruehl@apache.org.