use of org.eclipse.n4js.tester.domain.ID in project n4js by eclipse.
the class TestTreeTransformerTest method createTestTree.
private TestTree createTestTree(final Multimap<String, String> suiteToCasesMapping) {
checkArgument(!suiteToCasesMapping.isEmpty());
final TestTree tree = new TestTree(new ID(randomUUID().toString()));
final List<TestSuite> suites = newArrayList();
suiteToCasesMapping.asMap().entrySet().forEach(entry -> {
final TestSuite suite = new TestSuite(entry.getKey());
entry.getValue().forEach(testCaseName -> suite.add(new TestCase(new ID(testCaseName), "class.name." + suite.getName(), "project.origin." + suite.getName(), testCaseName, "display.name." + testCaseName, URI.createURI("testURI_" + testCaseName))));
suites.add(suite);
});
tree.getSuites().addAll(suites);
return tree;
}
use of org.eclipse.n4js.tester.domain.ID in project n4js by eclipse.
the class TesterDomainTest method newTestCase.
private Collection<? extends TestCase> newTestCase(final String testId, final String... otherIds) {
final List<TestCase> cases = newArrayList();
asList(testId, otherIds).forEach(id -> cases.add(new TestCase(new ID(id), "className." + id, "origin." + id, "name." + id, "displayName." + id, URI.createURI("testURI_" + id))));
return cases;
}
use of org.eclipse.n4js.tester.domain.ID in project n4js by eclipse.
the class TesterDomainTest method testSerializeAndCloneId.
/**
*/
@Test
public void testSerializeAndCloneId() throws Exception {
final ID actual = mapper.readValue("{\"value\":\"someId\"}", ID.class);
assertNotNull(actual);
assertTrue("someId".equals(actual.getValue()));
final ID expected = new ID("someId");
assertEquals(expected, actual);
assertEquals(expected.getValue(), actual.getValue());
final ID clone = actual.clone();
assertEquals(actual, clone);
assertEquals(actual.getValue(), clone.getValue());
assertFalse(actual == clone);
}
use of org.eclipse.n4js.tester.domain.ID in project n4js by eclipse.
the class TesterDomainTest method testTreeContainsTest.
/**
*/
@Test
public void testTreeContainsTest() {
final TestTree tree = new TestTree(new ID(valueOf(randomUUID())));
final TestSuite a = new TestSuite("A");
a.addAll(newTestCase("1", "2", "3"));
final TestSuite b = new TestSuite("B");
b.addAll(newTestCase("4", "5", "6"));
final TestSuite a1 = new TestSuite("A.1");
a1.addAll(newTestCase("7", "8"));
final TestSuite a2 = new TestSuite("A.2");
a2.addAll(newTestCase("9", "10"));
final TestSuite a11 = new TestSuite("A.1.1");
a11.addAll(newTestCase("11", "12"));
a1.getChildren().add(a11);
a.getChildren().add(a1);
a.getChildren().add(a2);
tree.getSuites().add(a);
tree.getSuites().add(b);
assertNotNull(tree.getTestCase("1"));
assertNotNull(tree.getTestCase("2"));
assertNotNull(tree.getTestCase("3"));
assertNotNull(tree.getTestCase("4"));
assertNotNull(tree.getTestCase("5"));
assertNotNull(tree.getTestCase("6"));
assertNotNull(tree.getTestCase("7"));
assertNotNull(tree.getTestCase("8"));
assertNotNull(tree.getTestCase("9"));
assertNotNull(tree.getTestCase("10"));
assertNotNull(tree.getTestCase("11"));
assertNotNull(tree.getTestCase("12"));
assertNull(tree.getTestCase("13"));
assertNull(tree.getTestCase((String) null));
assertNull(tree.getTestCase((ID) null));
}
use of org.eclipse.n4js.tester.domain.ID in project n4js by eclipse.
the class ResultNode method addChild.
private void addChild(ResultNode child) {
if (isLeaf())
throw new IllegalStateException("cannot add a child to a leaf node");
children.add(child);
final ID childId = child.getId();
if (childId != null)
getRoot().nodeRegistry.put(childId, child);
}
Aggregations