DialogHelper { static Product getSelectedSmosProduct(AppContext appContext) { final Product selectedProduct = appContext.getSelectedProduct(); if (selectedProduct != null) { if (isSupportedType(selectedProduct.getProductType())) { return selectedProduct; } } return null; }    }
@Test public void testGetSelectedSmosProduct_noProduct() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); assertNull(appContext.getSelectedProduct()); assertNull(DialogHelper.getSelectedSmosProduct(appContext)); }
@Test public void testGetSelectedSmosProduct_wrongProductType() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); appContext.setSelectedProduct(new Product("test", "MER_RR__1P", 2, 2)); assertNotNull(appContext.getSelectedProduct()); assertNull(DialogHelper.getSelectedSmosProduct(appContext)); }
@Test public void testGetSelectedSmosProduct_validProductType() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); final Product expectedProduct = new Product("test", "MIR_OSUDP2", 2, 2); appContext.setSelectedProduct(expectedProduct); assertNotNull(appContext.getSelectedProduct()); final Product selectedProduct = DialogHelper.getSelectedSmosProduct(appContext); assertEquals(expectedProduct, selectedProduct); }