### Question:
NumberFieldActions implements AtlasFieldAction { @AtlasActionProcessor public static Number convertMassUnit(ConvertMassUnit convertMassUnit, Number input) { if (input == null) { return 0; } if (convertMassUnit == null || convertMassUnit.getFromUnit() == null || convertMassUnit.getToUnit() == null) { throw new IllegalArgumentException("ConvertMassUnit must be specified with fromUnit and toUnit"); } MassUnitType fromUnit = convertMassUnit.getFromUnit(); MassUnitType toUnit = convertMassUnit.getToUnit(); double rate = massConvertionTable.get(fromUnit).get(toUnit); return doMultiply(input, rate); }  @AtlasActionProcessor static Number absoluteValue(AbsoluteValue action, Number input); @AtlasActionProcessor static Number add(Add action, List<Number> inputs); @AtlasActionProcessor static Number average(Average action, List<Number> inputs); @AtlasActionProcessor static Number ceiling(Ceiling action, Number input); @AtlasActionProcessor static Number convertMassUnit(ConvertMassUnit convertMassUnit, Number input); @AtlasActionProcessor static Number convertDistanceUnit(ConvertDistanceUnit convertDistanceUnit, Number input); @AtlasActionProcessor static Number convertAreaUnit(ConvertAreaUnit convertAreaUnit, Number input); @AtlasActionProcessor static Number convertVolumeUnit(ConvertVolumeUnit convertVolumeUnit, Number input); @AtlasActionProcessor static Number divide(Divide divide, List<Number> inputs); @AtlasActionProcessor static Number floor(Floor floor, Number input); @AtlasActionProcessor static Number maximum(Maximum maximum, List<Number> inputs); @AtlasActionProcessor static Number minimum(Minimum minimum, List<Number> inputs); @AtlasActionProcessor static Number multiply(Multiply multiply, List<Number> inputs); @AtlasActionProcessor static Number round(Round action, Number input); @AtlasActionProcessor static Number subtract(Subtract subtract, List<Number> inputs);  }### Answer:
@Test public void testConvertMassUnit() { ConvertMassUnit action = new ConvertMassUnit(); action.setFromUnit(MassUnitType.KILOGRAM_KG); action.setToUnit(MassUnitType.POUND_LB); assertEquals(11, NumberFieldActions.convertMassUnit(action, 5).intValue()); action.setFromUnit(MassUnitType.POUND_LB); action.setToUnit(MassUnitType.KILOGRAM_KG); assertEquals(4.5359235f, NumberFieldActions.convertMassUnit(action, 10.0f).floatValue(), 0); assertEquals(0, NumberFieldActions.convertMassUnit(action, null).intValue()); }
@Test(expected = IllegalArgumentException.class) public void testConvertMassUnitErrorNoFromNorToSpecified() { ConvertMassUnit action = new ConvertMassUnit(); assertEquals(11, NumberFieldActions.convertMassUnit(action, 5)); }
@Test(expected = IllegalArgumentException.class) public void testConvertMassUnitErrorNoFromSpecified() { ConvertMassUnit action = new ConvertMassUnit(); action.setToUnit(MassUnitType.POUND_LB); assertEquals(11, NumberFieldActions.convertMassUnit(action, 5)); }
@Test(expected = IllegalArgumentException.class) public void testConvertMassUnitErrorNoToSpecified() { ConvertMassUnit action = new ConvertMassUnit(); action.setFromUnit(MassUnitType.KILOGRAM_KG); assertEquals(11, NumberFieldActions.convertMassUnit(action, 5)); }
@Test(expected = IllegalArgumentException.class) public void testConvertMassUnitIllegalArgumentException() { assertEquals(11, NumberFieldActions.convertMassUnit(new ConvertMassUnit(), 5).intValue()); }