SmacUtils { public static String getSensorType(String productType) { Guardian.assertNotNull("productType", productType); if (isSupportedAatsrProductType(productType)) { return SensorCoefficientManager.AATSR_NAME; } else if (isSupportedMerisProductType(productType)) { return SensorCoefficientManager.MERIS_NAME; } return null; }  static String getSensorType(String productType); static boolean isSupportedMerisProductType(String productType); static boolean isSupportedAatsrProductType(String productType); static boolean isSupportedProductType(String productType);  }
@Test public void testGetSensorTypeDoesNotAcceptNullParameter() { try { SmacUtils.getSensorType(null); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException ignored) { } }
@Test public void testGetSensorTypeReturnsCorrectType() { String type; type = SmacUtils.getSensorType(EnvisatConstants.AATSR_L1B_TOA_PRODUCT_TYPE_NAME); assertEquals(SensorCoefficientManager.AATSR_NAME, type); type = SmacUtils.getSensorType(EnvisatConstants.MERIS_FR_L1B_PRODUCT_TYPE_NAME); assertEquals(SensorCoefficientManager.MERIS_NAME, type); type = SmacUtils.getSensorType(EnvisatConstants.MERIS_RR_L1B_PRODUCT_TYPE_NAME); assertEquals(SensorCoefficientManager.MERIS_NAME, type); }
@Test public void testGetSensorTypeIsNullOnIllegalTypes() { assertNull(SmacUtils.getSensorType("Nasenann")); assertNull(SmacUtils.getSensorType("strange")); assertNull(SmacUtils.getSensorType("")); }