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/27 07:36:06 UTC
[incubator-plc4x] branch master updated: add a couple more tests
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
The following commit(s) were added to refs/heads/master by this push:
new 2a6426f add a couple more tests
2a6426f is described below
commit 2a6426f3674ad1f7e4759b228e00db75433dbe94
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Tue Feb 27 18:35:57 2018 +1100
add a couple more tests
---
.../apache/plc4x/java/ads/ADSPlcDriverTest.java | 25 +++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSPlcDriverTest.java b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSPlcDriverTest.java
index b6f57db..2d5040d 100644
--- a/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSPlcDriverTest.java
+++ b/plc4j/protocols/ads/src/test/java/org/apache/plc4x/java/ads/ADSPlcDriverTest.java
@@ -29,8 +29,12 @@ import org.apache.plc4x.java.api.exceptions.PlcException;
import org.junit.Rule;
import org.junit.Test;
+import java.net.UnknownHostException;
+
import static org.apache.plc4x.java.ads.util.Junit5Backport.assertThrows;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
public class ADSPlcDriverTest {
@@ -54,8 +58,12 @@ public class ADSPlcDriverTest {
@Test(expected = PlcConnectionException.class)
public void getConnectionUnknownHost() throws Exception {
- new PlcDriverManager().getConnection("ads://:" + RandomStringUtils.randomAlphabetic(12) + "/0.0.0.0.0.0:13",
- new PlcUsernamePasswordAuthentication("admin", "admin"));
+ new PlcDriverManager().getConnection("ads://nowhere:8080/0.0.0.0.0.0:13");
+ }
+
+ @Test(expected = PlcConnectionException.class)
+ public void getConnectionUnknownPort() throws Exception {
+ new PlcDriverManager().getConnection("ads://nowhere:unknown/0.0.0.0.0.0:13");
}
/**
@@ -63,10 +71,17 @@ public class ADSPlcDriverTest {
*
* @throws PlcException something went wrong
*/
- @Test
+ @Test(expected = PlcConnectionException.class)
public void getConnectionInvalidUrl() throws PlcException {
- assertThrows(PlcConnectionException.class,
- () -> new PlcDriverManager().getConnection("ads://localhost/hurz/2"));
+ new PlcDriverManager().getConnection("ads://localhost/hurz/2");
}
+ @Test
+ public void getProtocol() {
+ ADSPlcDriver driver = new ADSPlcDriver();
+ assertThat(driver.getProtocolCode(), is("ads"));
+ assertThat(driver.getProtocolName(), is("Beckhoff Twincat ADS"));
+ }
+
+
}
--
To stop receiving notification emails like this one, please contact
jmclean@apache.org.