MplProcessMaterializer extends ProcessCommandsHelper { public ChainContainer materialize(MplProgram program) { Orientation3D orientation = program.getOrientation(); Coordinate3D max = program.getMax(); CommandChain install = visitInstall(program); CommandChain uninstall = visitUninstall(program); List<CommandChain> chains = new ArrayList<>(program.getProcesses().size()); for (MplProcess process : program.getProcesses()) { CommandChain chain = visitProcess(program, process); if (chain != null) { chains.add(chain); } } if (breakpoint != null) { chains.add(getBreakpointProcess(program)); } return new ChainContainer(orientation, max, install, uninstall, chains, program.getHash()); } MplProcessMaterializer(MplCompilerContext compilerContext); ChainContainer materialize(MplProgram program); @Nullable CommandChain visitProcess(MplProgram program, MplProcess process);  }
@Test public void test_when_visiting_a_breakpoint_the_breakpoint_process_is_added() { MplBreakpoint mplBreakpoint = some($MplBreakpoint() .withConditional(UNCONDITIONAL)); MplProgram program = some($MplProgram()); program.addProcess(some($MplProcess() .withChainParts(listOf(mplBreakpoint)))); ChainContainer result = underTest.materialize(program); Condition<CommandChain> condition = new Condition<CommandChain>() { @Override public boolean matches(CommandChain value) { return "breakpoint".equals(value.getName()); } }; assertThat(result.getChains()).haveExactly(1, condition); }