BooleanArrayToListResolveDependencyStrategy implements IResolveDependencyStrategy { @Override public <T> T resolve(final Object... args) throws ResolveDependencyStrategyException { try { boolean[] booleans = (boolean[]) args[0]; List<Boolean> result = new ArrayList<>(booleans.length); for (boolean aBoolean : booleans) { result.add(aBoolean); } return (T) result; } catch (Exception e) { throw new ResolveDependencyStrategyException("Can't create list from boolean array.", e); } }  @Override T resolve(final Object... args);  }
@Test public void ShouldConvertBooleanArrayToList() throws ResolveDependencyStrategyException { boolean[] array = new boolean[] {true, false}; List<Boolean> result = strategy.resolve(array); assertEquals(result.size(), 2); assertEquals(result.get(0), true); assertEquals(result.get(1), false); }
@Test(expected = ResolveDependencyStrategyException.class) public void ShouldThrowException_When_ErrorIsOccurred() throws ResolveDependencyStrategyException { boolean var = false; strategy.resolve(var); fail(); }