@Test public void computeStockWorth() { final CalculateNAV calculateNAV = new CalculateNAV( ticker -> new BigDecimal( "6.01" ) ); BigDecimal expected = new BigDecimal( "6010.00" ); assertEquals( 0, calculateNAV.computeStockWorth( "GOOG", 1000 ) .compareTo( expected ), 0.001 ); }
public BigDecimal computeStockWorth( final String ticker, final int shares ) { return priceFinder.apply( ticker ).multiply( BigDecimal.valueOf( shares ) ); }
CalculateNAV { public BigDecimal computeStockWorth( final String ticker, final int shares ) { return priceFinder.apply( ticker ).multiply( BigDecimal.valueOf( shares ) ); } }
CalculateNAV { public BigDecimal computeStockWorth( final String ticker, final int shares ) { return priceFinder.apply( ticker ).multiply( BigDecimal.valueOf( shares ) ); } CalculateNAV( final Function<String, BigDecimal> aPriceFinder ); }
CalculateNAV { public BigDecimal computeStockWorth( final String ticker, final int shares ) { return priceFinder.apply( ticker ).multiply( BigDecimal.valueOf( shares ) ); } CalculateNAV( final Function<String, BigDecimal> aPriceFinder ); BigDecimal computeStockWorth( final String ticker, final int shares ); }
CalculateNAV { public BigDecimal computeStockWorth( final String ticker, final int shares ) { return priceFinder.apply( ticker ).multiply( BigDecimal.valueOf( shares ) ); } CalculateNAV( final Function<String, BigDecimal> aPriceFinder ); BigDecimal computeStockWorth( final String ticker, final int shares );  }