| 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); |
| } |
| } |