public class ConnectionValidatorTestCase extends TestCase
{
public void testShouldDisallowDirectRun()
{
ConnectionValidator cv = new ConnectionValidator(new Client() {
public Map getConfiguration()
{
return new HashMap();
}
public ClientInvoker getInvoker()
{
try
{
return new MicroRemoteClientInvoker(
new InvokerLocator("http://dummy:65535/dummy/")) {
public String getSessionId()
{
return "dummyId";
}
protected String getDefaultDataType()
{
throw new UnsupportedOperationException();
}
protected void handleConnect() throws ConnectionFailedException
{
throw new UnsupportedOperationException();
}
protected void handleDisconnect()
{
throw new UnsupportedOperationException();
}
protected Object transport(String sessionId, Object invocation, Map metadata, Marshaller marshaller,
UnMarshaller unmarshaller) throws IOException, ConnectionFailedException, ClassNotFoundException
{
throw new UnsupportedOperationException();
}
};
}
catch (MalformedURLException e)
{
throw new RuntimeException(e);
}
}
});
try
{
cv.run();
fail("Should throw IllegalStateException");
} catch (IllegalStateException e) {
// Expected
}
}