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/11/24 18:32:11 UTC
[incubator-plc4x] branch develop updated: [plc4j-driver-bases-test]
enabled some tests.
This is an automated email from the ASF dual-hosted git repository.
sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new 2852c41 [plc4j-driver-bases-test] enabled some tests.
2852c41 is described below
commit 2852c41608a711e132b5d05c1e7a60d58af60baa
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Sat Nov 24 19:24:10 2018 +0100
[plc4j-driver-bases-test] enabled some tests.
---
.../org/apache/plc4x/java/mock/PlcMockConnectionTest.java | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/plc4j/protocols/driver-bases/test/src/test/java/org/apache/plc4x/java/mock/PlcMockConnectionTest.java b/plc4j/protocols/driver-bases/test/src/test/java/org/apache/plc4x/java/mock/PlcMockConnectionTest.java
index 37bcb1a..4a1da85 100644
--- a/plc4j/protocols/driver-bases/test/src/test/java/org/apache/plc4x/java/mock/PlcMockConnectionTest.java
+++ b/plc4j/protocols/driver-bases/test/src/test/java/org/apache/plc4x/java/mock/PlcMockConnectionTest.java
@@ -19,11 +19,13 @@
package org.apache.plc4x.java.mock;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.plc4x.java.api.messages.*;
import org.apache.plc4x.java.api.metadata.PlcConnectionMetadata;
+import org.apache.plc4x.java.api.model.PlcSubscriptionHandle;
+import org.apache.plc4x.java.api.types.PlcResponseCode;
import org.assertj.core.api.WithAssertions;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -32,6 +34,10 @@ import org.mockito.junit.jupiter.MockitoExtension;
import java.util.Collections;
import java.util.concurrent.CompletableFuture;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
@ExtendWith(MockitoExtension.class)
class PlcMockConnectionTest implements WithAssertions {
@@ -94,8 +100,9 @@ class PlcMockConnectionTest implements WithAssertions {
}
@Test
- @Disabled("due to mysterious NPE")
void write() throws Exception {
+ when(mockDevice.write(any(), any())).thenReturn(PlcResponseCode.OK);
+
PlcWriteRequest plcWriteRequest = SUT.writeRequestBuilder()
.addItem("asd", "asd", "asd")
.build();
@@ -106,8 +113,9 @@ class PlcMockConnectionTest implements WithAssertions {
}
@Test
- @Disabled("due to mysterious NPE")
void subscribe() throws Exception {
+ when(mockDevice.subscribe(any())).thenReturn(Pair.of(PlcResponseCode.OK, mock(PlcSubscriptionHandle.class)));
+
PlcSubscriptionRequest plcSubscriptionRequest = SUT.subscriptionRequestBuilder()
.addChangeOfStateField("asd", "asd")
.build();