LiveOperationRegistry { public void deregister(Operation operation) { Map<Long, Operation> operations = liveOperations.get(operation.getCallerAddress()); if (operations == null) { throw new IllegalStateException("Missing address during de-registration of operation=" + operation); } if (operations.remove(operation.getCallId()) == null) { throw new IllegalStateException("Missing operation during de-registration of operation=" + operation); } }  void register(Operation operation); void deregister(Operation operation); void populate(LiveOperations liveOperations);  }
@Test public void when_deregisterNotExistingAddress_then_fail() throws UnknownHostException { AsyncJobOperation op1 = createOperation("1.2.3.4", 1234, 2222L); exception.expect(IllegalStateException.class); r.deregister(op1); }