@Test(expectedExceptions = NullPointerException.class) public void shouldReturnNullPointerExceptionWhenParameterIsNull() { ScaleRoundedOperator.of(0, null); fail(); }
public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); }
ScaleRoundedOperator implements MonetaryOperator { public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); } }
ScaleRoundedOperator implements MonetaryOperator { public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); } private  ScaleRoundedOperator(int scale, RoundingMode roundingMode); }
ScaleRoundedOperator implements MonetaryOperator { public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); } private  ScaleRoundedOperator(int scale, RoundingMode roundingMode); static ScaleRoundedOperator of(int scale, RoundingMode roundingMode); @Override MonetaryAmount apply(MonetaryAmount amount); int getScale(); RoundingMode getRoundingMode(); @Override String toString(); }
ScaleRoundedOperator implements MonetaryOperator { public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); } private  ScaleRoundedOperator(int scale, RoundingMode roundingMode); static ScaleRoundedOperator of(int scale, RoundingMode roundingMode); @Override MonetaryAmount apply(MonetaryAmount amount); int getScale(); RoundingMode getRoundingMode(); @Override String toString();  }