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/08 13:28:00 UTC
[incubator-plc4x] branch master updated: [plc4j] added some more
tests
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 881336b [plc4j] added some more tests
881336b is described below
commit 881336b2f365e5ef94f129a0e1866e1659ecf3f8
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Thu Nov 8 14:27:04 2018 +0100
[plc4j] added some more tests
---
.../AdsDeviceNotificationResponseTest.java | 30 ++++++++
.../base/connection/AbstractPlcConnectionTest.java | 85 ++++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/AdsDeviceNotificationResponseTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/AdsDeviceNotificationResponseTest.java
new file mode 100644
index 0000000..e88fd1f
--- /dev/null
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/api/commands/AdsDeviceNotificationResponseTest.java
@@ -0,0 +1,30 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.ads.api.commands;
+
+import org.junit.jupiter.api.Test;
+
+class AdsDeviceNotificationResponseTest {
+
+ @Test
+ void coverage_test() {
+ new AdsDeviceNotificationResponse().getAdsData();
+ }
+}
\ No newline at end of file
diff --git a/plc4j/protocols/driver-bases/base/src/test/java/org/apache/plc4x/java/base/connection/AbstractPlcConnectionTest.java b/plc4j/protocols/driver-bases/base/src/test/java/org/apache/plc4x/java/base/connection/AbstractPlcConnectionTest.java
new file mode 100644
index 0000000..b5a3dc3
--- /dev/null
+++ b/plc4j/protocols/driver-bases/base/src/test/java/org/apache/plc4x/java/base/connection/AbstractPlcConnectionTest.java
@@ -0,0 +1,85 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.apache.plc4x.java.base.connection;
+
+import org.apache.commons.lang3.NotImplementedException;
+import org.apache.plc4x.java.api.exceptions.PlcUnsupportedOperationException;
+import org.assertj.core.api.WithAssertions;
+import org.junit.jupiter.api.Test;
+
+class AbstractPlcConnectionTest implements WithAssertions {
+
+ AbstractPlcConnection SUT = new AbstractPlcConnection() {
+ @Override
+ public void connect() {
+ throw new NotImplementedException("not used");
+ }
+
+ @Override
+ public boolean isConnected() {
+ throw new NotImplementedException("not used");
+ }
+
+ @Override
+ public void close() {
+ throw new NotImplementedException("not used");
+ }
+ };
+
+ @Test
+ void getMetadata() {
+ assertThat(SUT.getMetadata()).isNotNull().isSameAs(SUT);
+ }
+
+ @Test
+ void canRead() {
+ assertThat(SUT.canRead()).isFalse();
+ }
+
+ @Test
+ void canWrite() {
+ assertThat(SUT.canWrite()).isFalse();
+ }
+
+ @Test
+ void canSubscribe() {
+ assertThat(SUT.canSubscribe()).isFalse();
+ }
+
+ @Test
+ void readRequestBuilder() {
+ assertThatThrownBy(() -> SUT.readRequestBuilder()).isInstanceOf(PlcUnsupportedOperationException.class);
+ }
+
+ @Test
+ void writeRequestBuilder() {
+ assertThatThrownBy(() -> SUT.writeRequestBuilder()).isInstanceOf(PlcUnsupportedOperationException.class);
+ }
+
+ @Test
+ void subscriptionRequestBuilder() {
+ assertThatThrownBy(() -> SUT.subscriptionRequestBuilder()).isInstanceOf(PlcUnsupportedOperationException.class);
+ }
+
+ @Test
+ void unsubscriptionRequestBuilder() {
+ assertThatThrownBy(() -> SUT.unsubscriptionRequestBuilder()).isInstanceOf(PlcUnsupportedOperationException.class);
+ }
+}
\ No newline at end of file