diff --git a/test/src/test/java/org/springframework/ws/mock/client/ErrorResponseCallbackTest.java b/test/src/test/java/org/springframework/ws/mock/client/ErrorResponseCallbackTest.java
new file mode 100644
index 00000000..ed36cbd3
--- /dev/null
+++ b/test/src/test/java/org/springframework/ws/mock/client/ErrorResponseCallbackTest.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005-2010 the original author or authors.
+ *
+ * Licensed 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.springframework.ws.mock.client;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ErrorResponseCallbackTest {
+
+ @Test
+ public void callback() throws IOException {
+ String errorMessage = "Error message";
+ ErrorResponseCallback callback = new ErrorResponseCallback(errorMessage);
+ callback.doWithResponse(null, null);
+ assertEquals(errorMessage, callback.getErrorMessage());
+ }
+}
diff --git a/test/src/test/java/org/springframework/ws/mock/client/MockSenderConnectionTest.java b/test/src/test/java/org/springframework/ws/mock/client/MockSenderConnectionTest.java
new file mode 100644
index 00000000..04b40e20
--- /dev/null
+++ b/test/src/test/java/org/springframework/ws/mock/client/MockSenderConnectionTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005-2010 the original author or authors.
+ *
+ * Licensed 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.springframework.ws.mock.client;
+
+import java.io.IOException;
+
+import org.springframework.xml.transform.StringSource;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MockSenderConnectionTest {
+
+ @Test
+ public void error() throws IOException {
+ String testErrorMessage = "Test Error Message";
+ MockSenderConnection connection = new MockSenderConnection();
+ connection.andRespond(new ErrorResponseCallback(testErrorMessage));
+ assertTrue(connection.hasError());
+ assertEquals(testErrorMessage, connection.getErrorMessage());
+ }
+
+ @Test
+ public void normal() throws IOException {
+ MockSenderConnection connection = new MockSenderConnection();
+ connection.andRespond(new PayloadResponseCallback(new StringSource("")));
+ assertFalse(connection.hasError());
+ assertNull(connection.getErrorMessage());
+ }
+
+ @Test(expected = AssertionError.class)
+ public void noRequestMatchers() throws IOException {
+ MockSenderConnection connection = new MockSenderConnection();
+ connection.andRespond(new PayloadResponseCallback(new StringSource("")));
+ connection.send(null);
+ }
+}
diff --git a/test/src/test/java/org/springframework/ws/mock/client/MockWebServiceMessageSenderTest.java b/test/src/test/java/org/springframework/ws/mock/client/MockWebServiceMessageSenderTest.java
new file mode 100644
index 00000000..15e5ea0d
--- /dev/null
+++ b/test/src/test/java/org/springframework/ws/mock/client/MockWebServiceMessageSenderTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2005-2010 the original author or authors.
+ *
+ * Licensed 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.springframework.ws.mock.client;
+
+import java.io.IOException;
+import java.net.URI;
+
+import org.junit.Test;
+
+public class MockWebServiceMessageSenderTest {
+
+ @Test(expected = AssertionError.class)
+ public void testNoMoreExpectedConnections() throws IOException {
+ MockWebServiceMessageSender sender = new MockWebServiceMessageSender();
+ sender.createConnection(URI.create("http://localhost"));
+ }
+}
diff --git a/test/src/test/java/org/springframework/ws/mock/client/PayloadDiffMatcherTest.java b/test/src/test/java/org/springframework/ws/mock/client/PayloadDiffMatcherTest.java
index e426e90f..e7da3822 100644
--- a/test/src/test/java/org/springframework/ws/mock/client/PayloadDiffMatcherTest.java
+++ b/test/src/test/java/org/springframework/ws/mock/client/PayloadDiffMatcherTest.java
@@ -16,7 +16,11 @@
package org.springframework.ws.mock.client;
+import javax.xml.soap.MessageFactory;
+
import org.springframework.ws.WebServiceMessage;
+import org.springframework.ws.soap.SoapMessage;
+import org.springframework.ws.soap.saaj.SaajSoapMessage;
import org.springframework.xml.transform.StringSource;
import org.junit.Test;
@@ -50,4 +54,13 @@ public class PayloadDiffMatcherTest {
matcher.match(null, message);
}
+ @Test(expected = AssertionError.class)
+ public void noPayload() throws Exception {
+ PayloadDiffMatcher matcher = new PayloadDiffMatcher(new StringSource(""));
+ MessageFactory messageFactory = MessageFactory.newInstance();
+ SoapMessage soapMessage = new SaajSoapMessage(messageFactory.createMessage());
+
+ matcher.createDiff(soapMessage);
+ }
+
}
\ No newline at end of file
diff --git a/test/src/test/java/org/springframework/ws/mock/client/UriMatcherTest.java b/test/src/test/java/org/springframework/ws/mock/client/UriMatcherTest.java
new file mode 100644
index 00000000..5e2073f9
--- /dev/null
+++ b/test/src/test/java/org/springframework/ws/mock/client/UriMatcherTest.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005-2010 the original author or authors.
+ *
+ * Licensed 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.springframework.ws.mock.client;
+
+import java.net.URI;
+
+import org.junit.Test;
+
+public class UriMatcherTest {
+
+ private static final URI GOOD_URI = URI.create("http://localhost");
+
+ @Test
+ public void match() {
+ UriMatcher matcher = new UriMatcher(GOOD_URI);
+ matcher.match(GOOD_URI, null);
+ }
+
+ @Test(expected = AssertionError.class)
+ public void nonMatch() {
+ UriMatcher matcher = new UriMatcher(GOOD_URI);
+ matcher.match(URI.create("http://www.example.org"), null);
+ }
+}