@Test public void testSearchBeanWithStereotypeAndNamedParam() { String namedParam = "someBean"; NewStereotypeCreationWizard nb = new NewStereotypeCreationWizard(); nb.open(); nb.setName(stereotypeName); nb.setPackage(getPackageName()); nb.setInherited(false); nb.setNamed(true); nb.setAlternative(false); nb.setGenerateComments(false); nb.setRegisterInBeans(false); nb.finish(); wizard.createCDIComponentWithContent( CDIWizardType.BEAN, beanName, getPackageName(), null, BEAN_STEREOTYPE_NAMED_PATH); namedDialog = openSearchNamedDialog(); namedDialog.setNamedPrefix(beanName); assertTrue(namedDialog.matchingItems().size() == 0); namedDialog.setNamedPrefix(namedParam); assertTrue(namedDialog.matchingItems().size() == 1); namedDialog.ok(); assertTrue(new DefaultEditor().getTitle().equals(beanName + ".java")); assertTrue(new TextEditor().getSelectedText().equals(beanName)); }
@Test public void testSearchNamedParameterBean() { String namedParam = "someBean"; NewBeanCreationWizard nb = new NewBeanCreationWizard(); nb.open(); nb.setName(beanName); nb.setPackage(getPackageName()); nb.setPublic(true); nb.setAbstract(false); nb.setFinal(false); nb.setGenerateComments(false); nb.setAlternative(false); nb.setRegisterInBeans(false); nb.setNamed(true); nb.setBeanName(namedParam); nb.finish(); namedDialog = openSearchNamedDialog(); namedDialog.setNamedPrefix(namedParam); assertEquals(1, namedDialog.matchingItems().size()); namedDialog.ok(); assertTrue(new DefaultEditor().getTitle().equals(beanName + ".java")); assertTrue(new TextEditor().getSelectedText().equals(beanName)); }
@Test public void testSearchTwoSameNamedBean() { String beanName2 = "Bean2"; String namedParam = "someBean"; NewBeanCreationWizard nb = new NewBeanCreationWizard(); nb.open(); nb.setName(beanName); nb.setPackage(getPackageName()); nb.setPublic(true); nb.setAbstract(false); nb.setFinal(false); nb.setGenerateComments(false); nb.setAlternative(false); nb.setRegisterInBeans(false); nb.setNamed(true); nb.setBeanName(namedParam); nb.finish(); nb.open(); nb.setName(beanName2); nb.setPackage(getPackageName()); nb.setPublic(true); nb.setAbstract(false); nb.setFinal(false); nb.setGenerateComments(false); nb.setAlternative(false); nb.setRegisterInBeans(false); nb.setNamed(true); nb.setBeanName(namedParam); nb.finish(); namedDialog = openSearchNamedDialog(); namedDialog.setNamedPrefix(namedParam); List<String> matchingItems = namedDialog.matchingItems(); assertTrue(matchingItems.size() == 2); for (String matchingItem : matchingItems) { if (matchingItem.contains(beanName)) { namedDialog.setMatchingItems(matchingItem); break; } } namedDialog.ok(); assertTrue(new DefaultEditor().getTitle().equals(beanName + ".java")); assertTrue(new TextEditor().getSelectedText().equals(beanName)); }