@Override
    public Optional<IntentProcessPhase> execute() {
        try {
            List<Intent> compiled = processor.compile(data.intent(),
                    //TODO consider passing an optional here in the future
                    stored.map(IntentData::installables).orElse(null));
            return Optional.of(new Installing(processor, IntentData.compiled(data, compiled), stored));
        } catch (IntentException e) {
            log.warn("Unable to compile intent {} due to:", data.intent(), e);
            if (stored.filter(x -> !x.installables().isEmpty()).isPresent()) {
                // removing orphaned flows and deallocating resources
                return Optional.of(new Withdrawing(processor, IntentData.compiled(data, stored.get().installables())));
            } else {
                return Optional.of(new Failed(data));
            }
        }
    }
@Test
    public void testMoveToNextPhaseWithoutError() {
        IntentData pending = new IntentData(input, INSTALL_REQ, version);

        expect(processor.compile(input, null)).andReturn(Collections.singletonList(compiled));
        replay(processor);

        Compiling sut = new Compiling(processor, pending, Optional.empty());

        Optional<IntentProcessPhase> output = sut.execute();

        verify(processor);
        assertThat(output.get(), is(instanceOf(Installing.class)));
    }