public void testFeatures() {
    assertEquals("nb features", 2, factory.getFeatures().size());

    Node node;

    node = factory.getFeatures().get("test.main(java.lang.String[])");
    assertNotNull("feature test.main(java.lang.String[]) missing", node);
    assertTrue("feature test.main(java.lang.String[]) not concrete", node.isConfirmed());

    node = factory.getFeatures().get("test.test()");
    assertNotNull("feature test.test() missing", node);
    assertTrue("feature test.test() not concrete", node.isConfirmed());
  }
コード例 #2
0
  public void testFeatureFeature() {
    a.addDependency(b);
    a.addDependency(b_B);
    a.addDependency(b_B_b);
    a_A.addDependency(b);
    a_A.addDependency(b_B);
    a_A.addDependency(b_B_b);
    a_A_a.addDependency(b);
    a_A_a.addDependency(b_B);
    a_A_a.addDependency(b_B_b);

    Visitor visitor = new LinkMinimizer();
    visitor.traverseNodes(factory.getPackages().values());

    assertEquals("a outbound", 0, a.getOutboundDependencies().size());
    assertEquals("a inbound", 0, a.getInboundDependencies().size());
    assertEquals("a_A outbound", 0, a_A.getOutboundDependencies().size());
    assertEquals("a_A inbound", 0, a_A.getInboundDependencies().size());
    assertEquals("a_A_a outbound", 1, a_A_a.getOutboundDependencies().size());
    assertTrue("Missing a.A.a --> b.B.b", a_A_a.getOutboundDependencies().contains(b_B_b));
    assertEquals("a_A_a inbound", 0, a_A_a.getInboundDependencies().size());
    assertEquals("b outbound", 0, b.getOutboundDependencies().size());
    assertEquals("b inbound", 0, b.getInboundDependencies().size());
    assertEquals("b_B outbound", 0, b_B.getOutboundDependencies().size());
    assertEquals("b_B inbound", 0, b_B.getInboundDependencies().size());
    assertEquals("b_B_b outbound", 0, b_B_b.getOutboundDependencies().size());
    assertEquals("b_B_b inbound", 1, b_B_b.getInboundDependencies().size());
    assertTrue("Missing b.B.b <-- a.A.a", b_B_b.getInboundDependencies().contains(a_A_a));
  }
  public void testClasses() {
    assertEquals("nb classes", 3, factory.getClasses().size());

    Node node;

    node = factory.getClasses().get("test");
    assertNotNull("class test missing", node);
    assertTrue("class test not concrete", node.isConfirmed());

    node = factory.getClasses().get("java.io.PrintStream");
    assertNotNull("class java.io.PrintStream missing", node);
    assertFalse("class java.io.PrintStream is concrete", node.isConfirmed());

    node = factory.getClasses().get("java.util.Set");
    assertNotNull("class java.util.Set missing", node);
    assertFalse("class java.util.Set is concrete", node.isConfirmed());
  }
  public void testPackages() {
    assertEquals("nb packages", 3, factory.getPackages().size());

    Node node;

    node = factory.getPackages().get("");
    assertNotNull("default package missing", node);
    assertTrue("default package not concrete", node.isConfirmed());

    node = factory.getPackages().get("java.io");
    assertNotNull("package java.io missing", node);
    assertFalse("package java.io is concrete", node.isConfirmed());

    node = factory.getPackages().get("java.util");
    assertNotNull("package java.util missing", node);
    assertFalse("package java.util is concrete", node.isConfirmed());
  }
コード例 #5
0
  protected void setUp() throws Exception {
    factory = new NodeFactory();

    a = factory.createPackage("a");
    a_A = factory.createClass("a.A");
    a_A_a = factory.createFeature("a.A.a()");

    b = factory.createPackage("b");
    b_B = factory.createClass("b.B");
    b_B_b = factory.createFeature("b.B.b()");
  }