ResamplingFactory { public static Resampling createResampling(final String resamplingName) { switch (resamplingName) { case NEAREST_NEIGHBOUR_NAME: return Resampling.NEAREST_NEIGHBOUR; case BILINEAR_INTERPOLATION_NAME: return Resampling.BILINEAR_INTERPOLATION; case CUBIC_CONVOLUTION_NAME: return Resampling.CUBIC_CONVOLUTION; case BISINC_INTERPOLATION_NAME: return Resampling.BISINC_INTERPOLATION; case BICUBIC_INTERPOLATION_NAME: return Resampling.BICUBIC_INTERPOLATION; default: return null; } }  static Resampling createResampling(final String resamplingName); static final String NEAREST_NEIGHBOUR_NAME; static final String BILINEAR_INTERPOLATION_NAME; static final String CUBIC_CONVOLUTION_NAME; static final String BISINC_INTERPOLATION_NAME; static final String BICUBIC_INTERPOLATION_NAME; static final String[] resamplingNames; }
@Test public void testCreateResampling() { Resampling resampling; resampling = ResamplingFactory.createResampling(ResamplingFactory.CUBIC_CONVOLUTION_NAME); assertEquals(resampling.getName(), Resampling.CUBIC_CONVOLUTION.getName()); resampling = ResamplingFactory.createResampling(ResamplingFactory.NEAREST_NEIGHBOUR_NAME); assertEquals(resampling.getName(), Resampling.NEAREST_NEIGHBOUR.getName()); resampling = ResamplingFactory.createResampling(ResamplingFactory.BILINEAR_INTERPOLATION_NAME); assertEquals(resampling.getName(), Resampling.BILINEAR_INTERPOLATION.getName()); resampling = ResamplingFactory.createResampling(ResamplingFactory.BISINC_INTERPOLATION_NAME); assertEquals(resampling.getName(), Resampling.BISINC_INTERPOLATION.getName()); resampling = ResamplingFactory.createResampling(ResamplingFactory.BICUBIC_INTERPOLATION_NAME); assertEquals(resampling.getName(), Resampling.BICUBIC_INTERPOLATION.getName()); resampling = ResamplingFactory.createResampling("Not known"); assertTrue(resampling == null); }