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/01/12 15:32:27 UTC
[incubator-plc4x] branch master updated: added one missing testcase
for typed read response
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
The following commit(s) were added to refs/heads/master by this push:
new ef8c3d4 added one missing testcase for typed read response
ef8c3d4 is described below
commit ef8c3d44063b2ca6888b7a5eae744f14752760be
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Fri Jan 12 16:32:23 2018 +0100
added one missing testcase for typed read response
---
.../messages/specific/TypeSafePlcReadResponseTest.java | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/specific/TypeSafePlcReadResponseTest.java b/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/specific/TypeSafePlcReadResponseTest.java
index a701d20..2119d20 100644
--- a/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/specific/TypeSafePlcReadResponseTest.java
+++ b/plc4j/api/src/test/java/org/apache/plc4x/java/api/messages/specific/TypeSafePlcReadResponseTest.java
@@ -21,12 +21,15 @@ package org.apache.plc4x.java.api.messages.specific;
import org.apache.plc4x.java.api.messages.PlcReadResponse;
import org.apache.plc4x.java.api.messages.items.ReadRequestItem;
import org.apache.plc4x.java.api.messages.items.ReadResponseItem;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -36,7 +39,7 @@ class TypeSafePlcReadResponseTest {
@BeforeEach
void setUp() {
- readResponseItemString = new ReadResponseItem<>(mock(ReadRequestItem.class), null, Collections.emptyList());
+ readResponseItemString = new ReadResponseItem<>(mock(ReadRequestItem.class), null, Arrays.asList("", ""));
}
@Test
@@ -45,8 +48,14 @@ class TypeSafePlcReadResponseTest {
PlcReadResponse response = mock(PlcReadResponse.class);
when(response.getResponseItems()).thenReturn((List) Collections.singletonList(readResponseItemString));
new TypeSafePlcReadResponse<>(response);
- new TypeSafePlcReadResponse<>(mock(TypeSafePlcReadRequest.class), readResponseItemString);
- new TypeSafePlcReadResponse<>(mock(TypeSafePlcReadRequest.class), Collections.singletonList(readResponseItemString));
+ TypeSafePlcReadRequest mock = mock(TypeSafePlcReadRequest.class);
+ when(mock.getDataType()).thenReturn(String.class);
+ new TypeSafePlcReadResponse<>(mock, readResponseItemString);
+ new TypeSafePlcReadResponse<>(mock, Collections.singletonList(readResponseItemString));
+ Assertions.assertThrows(IllegalArgumentException.class, () ->{
+ when(mock.getDataType()).thenReturn(Byte.class);
+ new TypeSafePlcReadResponse<>(mock, readResponseItemString);
+ });
}
@Test
--
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].