FloatArrayToListResolveDependencyStrategy implements IResolveDependencyStrategy { @Override public <T> T resolve(final Object... args) throws ResolveDependencyStrategyException { try { float[] floats = (float[]) args[0]; List<Float> result = new ArrayList<>(floats.length); for (float aFloat : floats) { result.add(aFloat); } return (T) result; } catch (Exception e) { throw new ResolveDependencyStrategyException("Can't create list from float array.", e); } }  @Override T resolve(final Object... args);  }
@Test public void ShouldConvertFloatArrayToList() throws ResolveDependencyStrategyException { float[] array = new float[] {(float) 12.0, (float) 5.7}; List<Float> result = strategy.resolve(array); assertEquals(result.size(), 2); assertEquals(result.get(0), new Float(12.0)); assertEquals(result.get(1), new Float(5.7)); }
@Test(expected = ResolveDependencyStrategyException.class) public void ShouldThrowException_When_ErrorIsOccurred() throws ResolveDependencyStrategyException { Float[] array = new Float[] {new Float(1.0)}; strategy.resolve(array); fail(); }