Palette { public Optional<OperationMetaData> getOperationByName(String name) { return Optional.ofNullable(this.operations.get(checkNotNull(name, "name cannot be null"))); }  @Subscribe void onOperationAdded(OperationAddedEvent event); Collection<OperationMetaData> getOperations(); Optional<OperationMetaData> getOperationByName(String name);  }
@Test public void testGetOperation() { eventBus.post(new OperationAddedEvent(operation)); assertEquals(Optional.of(operation), palette.getOperationByName("Find Target")); }
@Test public void testGetNonexistantOperation() { eventBus.post(new OperationAddedEvent(operation)); assertEquals(Optional.empty(), palette.getOperationByName("Test")); }