DialogHelper { static boolean canProductSelectionBeEnabled(AppContext appContext) { final Product selectedProduct = appContext.getSelectedProduct(); if (selectedProduct != null) { return isSupportedType(selectedProduct.getProductType()); } return false; }    }
@Test public void testCanProductSelectionBeEnabled_noProduct() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); assertNull(appContext.getSelectedProduct()); assertFalse(DialogHelper.canProductSelectionBeEnabled(appContext)); }
@Test public void testCanProductSelectionBeEnabled_wrongProductType() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); appContext.setSelectedProduct(new Product("test", "MER_RR__1P", 2, 2)); assertNotNull(appContext.getSelectedProduct()); assertFalse(DialogHelper.canProductSelectionBeEnabled(appContext)); }
@Test public void testCanProductSelectionBeEnabled_validProductType() { assumeTrue(isGuiAvailable); final DefaultAppContext appContext = new DefaultAppContext("test"); appContext.setSelectedProduct(new Product("test", "MIR_SCLF1C", 2, 2)); assertNotNull(appContext.getSelectedProduct()); assertTrue(DialogHelper.canProductSelectionBeEnabled(appContext)); }