aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java')
-rw-r--r--WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java b/WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java
new file mode 100644
index 000000000..4b5c8256c
--- /dev/null
+++ b/WordPress/src/androidTest/java/org/wordpress/android/networking/XMLRPCTest.java
@@ -0,0 +1,35 @@
+package org.wordpress.android.networking;
+
+import org.wordpress.android.DefaultMocksInstrumentationTestCase;
+import org.wordpress.android.mocks.XMLRPCFactoryTest;
+import org.xmlrpc.android.ApiHelper.Method;
+import org.xmlrpc.android.XMLRPCClientInterface;
+import org.xmlrpc.android.XMLRPCFactory;
+
+import java.net.URI;
+
+public class XMLRPCTest extends DefaultMocksInstrumentationTestCase {
+ public void testNumberExceptionWithInvalidDouble() throws Exception {
+ XMLRPCFactoryTest.setPrefixAllInstances("invalid-double-xmlrpc");
+ XMLRPCClientInterface xmlrpcClientInterface = XMLRPCFactory.instantiate(URI.create("http://test.com/ast"), "",
+ "");
+ try {
+ xmlrpcClientInterface.call(Method.GET_MEDIA_LIBRARY, null);
+ } catch (NumberFormatException e) {
+ return;
+ }
+ assertTrue("invalid double format should trigger a NumberException", false);
+ }
+
+ public void testNumberExceptionWithInvalidInteger() throws Exception {
+ XMLRPCFactoryTest.setPrefixAllInstances("invalid-integer-xmlrpc");
+ XMLRPCClientInterface xmlrpcClientInterface = XMLRPCFactory.instantiate(URI.create("http://test.com/ast"), "",
+ "");
+ try {
+ xmlrpcClientInterface.call(Method.GET_MEDIA_LIBRARY, null);
+ } catch (NumberFormatException e) {
+ return;
+ }
+ assertTrue("invalid double format should trigger a NumberException", false);
+ }
+}