int counter = 1;
Uuid uuid;
FakeEndpoint endpoint;
FakeOutboundRequestIterator fakeIterator;
OutboundRequestIterator iterator;
BasicObjectEndpoint boe;
FakeOutputStream fos;
FakeOutboundRequest request;
logger.log(Level.FINE,"=================================");
logger.log(Level.FINE,"test case " + (counter++)
+ ": newCall with null InvocationConstraints");
logger.log(Level.FINE,"");
uuid = UuidFactory.create(1,2);
endpoint = new FakeEndpoint(new FakeOutboundRequestIterator(null));
boe = new BasicObjectEndpoint(endpoint,uuid,false);
try {
boe.newCall(null);
throw new AssertionError("newCall(null) should fail");
} catch (NullPointerException ignore) {}
for (int i = 0; i < cases.length; i++) {
logger.log(Level.FINE,"=================================");
Throwable nextException = cases[i];
logger.log(Level.FINE,"test case " + (counter++)
+ ": nextException:" + nextException);
logger.log(Level.FINE,"");
// Test Case: OutboundRequestIterator.next throws exception
uuid = UuidFactory.create(1,2);
fakeIterator = new FakeOutboundRequestIterator(null);
fakeIterator.setNextException(nextException);
endpoint = new FakeEndpoint(fakeIterator);
boe = new BasicObjectEndpoint(endpoint,uuid,false);
iterator = boe.newCall(InvocationConstraints.EMPTY);
try {
iterator.next();
throw new AssertionError("next() should fail");
} catch (Throwable caught) {
assertion(nextException.equals(caught),
caught.toString());
}
// Test Case: Uuid.write throws exception
fos = new FakeOutputStream(nextException);
request = new FakeOutboundRequest();
request.setRequestOutputStream(fos);
fakeIterator = new FakeOutboundRequestIterator(request);
endpoint = new FakeEndpoint(fakeIterator);
boe = new BasicObjectEndpoint(endpoint,uuid,false);
iterator = boe.newCall(InvocationConstraints.EMPTY);
try {
iterator.next();
throw new AssertionError("next() should fail");
} catch (Throwable caught) {
assertion(nextException.equals(caught),