WeightingFunctionFactory { public static WeightingFunction getWeightingFunction(final String weightingFunctionName) { final WeightingFunction function = s_staticInstances.get(weightingFunctionName); if (function != null) { return function; } throw new IllegalArgumentException("Weighting function not handled: " + weightingFunctionName); } private  WeightingFunctionFactory(); static WeightingFunction getWeightingFunction(final String weightingFunctionName); static String getWeightingFunctionName(final WeightingFunction function); static final String COSINE_WEIGHTING_FUNCTION_NAME; static final String SINE_WEIGHTING_FUNCTION_NAME; static final String LINEAR_WEIGHTING_FUNCTION_NAME; static final CosineWeightingFunction COSINE_WEIGHTING_FUNCTION; static final SineWeightingFunction SINE_WEIGHTING_FUNCTION; static final LinearWeightingFunction LINEAR_WEIGHTING_FUNCTION; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testBadName() { getWeightingFunction("Random"); }