private void doTestNewBatchArtifactWizard( BatchArtifactType type, String typeName, boolean deriveFromInterface, String artifactName, List<String> properties) throws CoreException { NewBatchArtifactWizardContext context = new NewBatchArtifactWizardContext(); context.init(NewBatchArtifactWizard.WIZARD_ID, "batch", typeName); try { NewBatchArtifactWizardPage page = context.wizard.getPage(); page.setArtifact(type, true); if (deriveFromInterface) { page.setDeriveFromInterface(); } if (artifactName != null) { page.setArtifactName(artifactName); } if (properties != null && !properties.isEmpty()) { page.setProperties(properties); } context.wizard.performFinish(); String text = context.getNewTypeContent(); if (type.getClassName() != null && !deriveFromInterface) { assertTrue(text.contains("extends " + getElememtName(type.getClassName()))); } else { assertTrue(text.contains("implements " + getElememtName(type.getInterfaceName()))); } assertTrue(text.contains("@Named")); if (artifactName != null) { assertTrue(text.contains("@Named(\"" + artifactName + "\")")); } if (properties != null && !properties.isEmpty()) { assertTrue(text.contains("@Inject")); assertTrue(text.contains("@BatchProperty")); for (String s : properties) { assertTrue(text.contains("String " + s + ";")); } } context.findType().getResource().delete(true, new NullProgressMonitor()); } finally { context.close(); } }
public void testAllArtifacts() { assertNotNull(batchProject); Collection<IBatchArtifact> cs = batchProject.getAllArtifacts(); assertFalse(cs.isEmpty()); int total = cs.size(); int total2 = 0; for (BatchArtifactType t : BatchArtifactType.values()) { cs = batchProject.getArtifacts(t); total2 += cs.size(); } assertEquals(total, total2); }