BrowseFormatExporter extends AbstractFormatExporter { static int getBtDataDimension(String productName) { final String productType = SmosUtils.getProductType(productName); if ("MIR_BWLF1C".equalsIgnoreCase(productType) || "MIR_BWNF1C".equalsIgnoreCase(productType) || "MIR_BWSF1C".equalsIgnoreCase(productType)) { return 4; } else if ("MIR_BWLD1C".equalsIgnoreCase(productType) || "MIR_BWND1C".equalsIgnoreCase(productType) || "MIR_BWSD1C".equalsIgnoreCase(productType)) { return 2; } else { throw new IllegalArgumentException("unsupported product: " + productName); } }  @Override void initialize(Product product, ExportParameter exportParameter); @Override void addDimensions(NFileWriteable nFileWriteable); @Override void writeData(NFileWriteable nFileWriteable);  }
@Test public void testGetBtDataDimension() { assertEquals(2, BrowseFormatExporter.getBtDataDimension("SM_OPER_MIR_BWLD1C_20130326T122713_20110326T132027_505_001_1.zip")); assertEquals(4, BrowseFormatExporter.getBtDataDimension("SM_OPER_MIR_BWLF1C_20130326T122713_20110326T132027_505_001_1.zip")); assertEquals(2, BrowseFormatExporter.getBtDataDimension("SM_OPER_MIR_BWSD1C_20100201T134256_20100201T140057_324_001_1.zip")); assertEquals(4, BrowseFormatExporter.getBtDataDimension("SM_TEST_MIR_BWSF1C_20100802T153857_20100802T163215_620_001_1.HDR")); }
@Test public void testGetBtDataDimension_throwsOnInvalidFilename() { try { BrowseFormatExporter.getBtDataDimension("SM_OPER_MIR_SMUDP2_20130326T190735_20130326T200046_551_001_1.zip"); } catch (IllegalArgumentException expected) { } }