BloombergPriceConverter { public static double getMultiplier( Commodity commodity ) { double multiplier = 0; if( commodity == JAPANESE_YEN_GLOBEX ) { multiplier = 10000.0; } else if( commodity == CANADIAN_DOLLAR_GLOBEX || commodity == COPPER_NYMEX || commodity == HEATING_OIL_NYMEX || commodity == SWISS_FRANC_GLOBEX ) { multiplier = 100.0; } else if( commodity == CORN_ECBOT || commodity == CRUDE_OIL_NYMEX || commodity == DOW_INDEX_MINI_ECBOT || commodity == EURO_GLOBEX || commodity == GOLD_NYMEX || commodity == NASDAQ100_INDEX_MINI_GLOBEX || commodity == NATURAL_GAS_NYMEX || commodity == SILVER_NYMEX || commodity == SOYBEANS_ECBOT || commodity == SP500_INDEX_MINI_GLOBEX || commodity == BOND_30_YEAR_ECBOT || commodity == BOND_10_YEAR_ECBOT || commodity == WHEAT_ECBOT ) { multiplier = 1.0; } else { throw new IllegalStateException( "Unknown Commodity: " + commodity ); } return multiplier; }  static double nativeToBloomberg( double nativePrice, Commodity commodity ); static double bloombergToNative( double bloombergPrice, Commodity commodity ); static double getMultiplier( Commodity commodity );  }
@Test public void testGetMultiplier() { checkValue(100.0, CANADIAN_DOLLAR_GLOBEX); checkValue(100.0, COPPER_NYMEX); checkValue(100.0, HEATING_OIL_NYMEX ); checkValue(100.0, SWISS_FRANC_GLOBEX ); checkValue(10000.0, JAPANESE_YEN_GLOBEX ); checkValue(1.0, CORN_ECBOT ); checkValue(1.0, CRUDE_OIL_NYMEX ); checkValue(1.0, DOW_INDEX_MINI_ECBOT ); checkValue(1.0, EURO_GLOBEX ); checkValue(1.0, GOLD_NYMEX ); checkValue(1.0, NASDAQ100_INDEX_MINI_GLOBEX ); checkValue(1.0, NATURAL_GAS_NYMEX ); checkValue(1.0, SILVER_NYMEX ); checkValue(1.0, SOYBEANS_ECBOT ); checkValue(1.0, BOND_30_YEAR_ECBOT ); checkValue(1.0, BOND_10_YEAR_ECBOT ); checkValue(1.0, WHEAT_ECBOT ); try { BloombergPriceConverter.getMultiplier(null); fail(); } catch( IllegalStateException ex ) { } }