OperationProcessorImpl implements OperationProcessor { @Override public <T> boolean supply(Cloud cloud, OperationType operationType, Supplier<T> supplier) { Operation operation = doChecks(operationType, supplier); if (operation instanceof ConsumingOperation) { @SuppressWarnings("unchecked") boolean result = ((ConsumingOperation<T>) operation).perform(cloud, supplier); return result; } else { LOG.error("Operation {} should be a consuming operation", operationType); return false; } } @Autowired  OperationProcessorImpl(OperationsAware operationsAware); @Override boolean consume(Cloud cloud, OperationType operationType, Consumer<T> consumer); @Override boolean consume(Cloud cloud, OperationType operationType, Set<String> ids, Consumer<T> consumer); @Override boolean supply(Cloud cloud, OperationType operationType, Supplier<T> supplier); @Override Optional<O> process(Cloud cloud, OperationType operationType, Supplier<I> supplier);  }
@Test public void testSupply() { assertThat( operationProcessor.supply(CLOUD, ADD_INSTANCE, () -> TEST_STRING), is(true) ); }
@Test public void testSupplyNotConsumingOperation() { assertThat( operationProcessor.supply(CLOUD, LIST_INSTANCES, () -> TEST_STRING), is(false) ); }