public void testRemoteFileDescCreatorsAreAskedIfTheyCanCreateRFD() { final RemoteFileDescCreator creator = context.mock(RemoteFileDescCreator.class); remoteFileDescFactory.register(creator); final Address address = context.mock(Address.class); final byte[] clientGuid = GUID.makeGuid(); context.checking( new Expectations() { { one(creator).canCreateFor(address); will(returnValue(true)); one(creator) .create( address, 1, "hello", 2, clientGuid, 1, 1, true, null, URN.NO_URN_SET, false, "vendor", -1, false); will(returnValue(null)); } }); RemoteFileDesc rfd = remoteFileDescFactory.createRemoteFileDesc( address, 1, "hello", 2, clientGuid, 1, 1, true, null, URN.NO_URN_SET, false, "vendor", -1, false, null); assertNull(rfd); context.assertIsSatisfied(); }