public void testReleaseService_WrongChildOrRequestor()
throws TooManyListenersException {
MockBeanContextServicesSupport support = new MockBeanContextServicesSupport();
MockBeanContextServiceProvider provider = new MockBeanContextServiceProvider();
support.addService(Collection.class, provider);
MockBeanContextChild child = new MockBeanContextChild();
support.add(child);
Object requestor = "a requestor";
Object selector = "a selector";
MockBeanContextServiceRevokedListener l = new MockBeanContextServiceRevokedListener();
support.records.clear();
Object service = support.getService(child, requestor, Collection.class,
selector, l);
assertSame(Collections.EMPTY_SET, service);
provider.records.assertRecord("getService", support, requestor,
Collection.class, selector, service);
provider.records.assertEndOfRecords();
support.records.assertEndOfRecords();
try {
support.releaseService(new MockBeanContextChild(), requestor,
service);
fail();
} catch (IllegalArgumentException e) {
// expected
}