Search in sources :

Example 1 with ID

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;
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite) TestCase(org.eclipse.n4js.tester.domain.TestCase) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree)

Example 2 with ID

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;
}
Also used : TestCase(org.eclipse.n4js.tester.domain.TestCase) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID)

Example 3 with ID

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);
}
Also used : ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) Test(org.junit.Test)

Example 4 with ID

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));
}
Also used : TestSuite(org.eclipse.n4js.tester.domain.TestSuite) ID(org.eclipse.n4js.tester.domain.ID) UUID.randomUUID(java.util.UUID.randomUUID) TestTree(org.eclipse.n4js.tester.domain.TestTree) Test(org.junit.Test)

Example 5 with ID

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);
}
Also used : ID(org.eclipse.n4js.tester.domain.ID)

Aggregations

ID (org.eclipse.n4js.tester.domain.ID)11 UUID.randomUUID (java.util.UUID.randomUUID)9 TestSuite (org.eclipse.n4js.tester.domain.TestSuite)7 TestTree (org.eclipse.n4js.tester.domain.TestTree)7 TestCase (org.eclipse.n4js.tester.domain.TestCase)5 Test (org.junit.Test)4 Function (com.google.common.base.Function)1 URI (org.eclipse.emf.common.util.URI)1 SessionEndedEvent (org.eclipse.n4js.tester.events.SessionEndedEvent)1 SessionFailedEvent (org.eclipse.n4js.tester.events.SessionFailedEvent)1 SessionFinishedEvent (org.eclipse.n4js.tester.events.SessionFinishedEvent)1 SessionStartedEvent (org.eclipse.n4js.tester.events.SessionStartedEvent)1 TestEndedEvent (org.eclipse.n4js.tester.events.TestEndedEvent)1 TestStartedEvent (org.eclipse.n4js.tester.events.TestStartedEvent)1 TModule (org.eclipse.n4js.ts.types.TModule)1