*
*/
public void testEncodeResponseForFailure() throws SecurityException,
NoSuchMethodException, SerializationException {
// Case 1
RPC.encodeResponseForFailure(null, new SerializableException());
Method A_method1 = null;
A_method1 = A.class.getMethod("method1");
// Case 2
try {
RPC.encodeResponseForFailure(A_method1, null);
fail("Expected NullPointerException");
} catch (NullPointerException e) {
// expected to get here
}
// Case 3
try {
RPC.encodeResponseForFailure(A.class.getMethod("method1"),
new IllegalArgumentException());
fail("Expected UnexpectedException");
} catch (UnexpectedException e) {
// expected to get here
}
// Case 4
String str = RPC.encodeResponseForFailure(A.class.getMethod("method1"),
new SerializableException());
assertTrue(str.indexOf("SerializableException") != -1);
}