MplChainPlacer { public int getLongestSuccessiveConditionalCount() { return Stream .concat(container.getChains().stream().map(c -> c.getCommands()), Stream.of(getInstall().getCommands(), getUninstall().getCommands())) .map(commands -> getLongestSuccessiveConditionalCount(commands)).max(naturalOrder()) .orElse(0); } protected  MplChainPlacer(ChainContainer container, MinecraftVersion version,
      CompilerOptions options); abstract List<CommandBlockChain> place(); CommandBlockChain generateFlat(CommandChain chain, Coordinate3D start, Directions template); LinkedHashMap<Position, ChainLinkType> place(Chain chain, Directions template); int getLongestSuccessiveConditionalCount(); static int getLongestSuccessiveConditionalCount(List<? extends ChainLink> chainLinks); static Coordinate3D toCoordinate(Position pos, Orientation3D orientation); static Position toPosition(Coordinate3D coord, Orientation3D orientation); static boolean isTransmitter(MplBlock block); static boolean isTransmitter(ChainLink chainLink); static boolean isReceiver(MplBlock block); static boolean isReceiver(ChainLink chainLink); static ChainLinkType getType(ChainLink chainLink);  }
@Test public void getLongestSuccessiveConditionalCount_is_1_for_one_conditional() { Command conditional = some($Command().withConditional(true)); LinkedList<Command> list = new LinkedList<>(); list.add(conditional); int result = MplChainPlacer.getLongestSuccessiveConditionalCount(list); assertThat(result).isEqualTo(1); }
@Test public void getLongestSuccessiveConditionalCount_is_n_for_n_conditionals() { List<Command> list = listOf(several(), $Command().withConditional(true)); int result = MplChainPlacer.getLongestSuccessiveConditionalCount(list); assertThat(result).isEqualTo(list.size()); }
@Test public void getLongestSuccessiveConditionalCount_is_max_of_m_and_n_for_m_plus_n_conditionals() { List<Command> conditionals1 = listOf(several(), $Command().withConditional(true)); List<Command> unconditionals = listOf(someInt(1, 100), $Command().withConditional(false)); List<Command> conditionals2 = listOf(several(), $Command().withConditional(true)); List<Command> list = new LinkedList<>(); list.addAll(conditionals1); list.addAll(unconditionals); list.addAll(conditionals2); int result = MplChainPlacer.getLongestSuccessiveConditionalCount(list); assertThat(result).isEqualTo(Math.max(conditionals1.size(), conditionals2.size())); }
@Test public void getLongestSuccessiveConditionalCount_throws_NullPointerException() { try { MplChainPlacer.getLongestSuccessiveConditionalCount(null); } catch (NullPointerException ex) { assertThat(ex.getMessage()).isEqualTo("chainLinks == null!"); } }
@Test public void getLongestSuccessiveConditionalCount_is_0_for_empty_list() { int result = MplChainPlacer.getLongestSuccessiveConditionalCount(new LinkedList<>()); assertThat(result).isZero(); }
@Test public void getLongestSuccessiveConditionalCount_is_0_for_multiple_unconditionals() { List<Command> list = listOf(several(), $Command().withConditional(false)); int result = MplChainPlacer.getLongestSuccessiveConditionalCount(list); assertThat(result).isZero(); }