Example #1
0
 public void testMethodKey() throws Exception {
   MethodKey factory = (MethodKey) KeyFactory.create(MethodKey.class);
   Set methodSet = new HashSet();
   methodSet.add(factory.newInstance(Number.class, new Class[] {int.class}));
   assertTrue(methodSet.contains(factory.newInstance(Number.class, new Class[] {int.class})));
   assertTrue(!methodSet.contains(factory.newInstance(Number.class, new Class[] {Integer.class})));
 }
Example #2
0
  /** Check if the getSubBuilders properly predicts the output. */
  public static void testSubBuilders() throws Exception {
    Workspace ws = Workspace.getWorkspace(new File("test/ws"));
    Project project = ws.getProject("p4-sub");

    Collection<? extends Builder> bs = project.getSubBuilders();
    assertNotNull(bs);
    assertEquals(3, bs.size());
    Set<String> names = new HashSet<String>();
    for (Builder b : bs) {
      names.add(b.getBsn());
    }
    assertTrue(names.contains("p4-sub.a"));
    assertTrue(names.contains("p4-sub.b"));
    assertTrue(names.contains("p4-sub.c"));

    File[] files = project.build();
    assertTrue(project.check());

    System.err.println(Processor.join(project.getErrors(), "\n"));
    System.err.println(Processor.join(project.getWarnings(), "\n"));
    assertEquals(0, project.getErrors().size());
    assertEquals(0, project.getWarnings().size());
    assertNotNull(files);
    assertEquals(3, files.length);
    for (File file : files) {
      Jar jar = new Jar(file);
      Manifest m = jar.getManifest();
      assertTrue(names.contains(m.getMainAttributes().getValue("Bundle-SymbolicName")));
    }
  }
 /** keySet returns a Set containing all the keys */
 public void testDescendingKeySet() {
   ConcurrentNavigableMap map = dmap5();
   Set s = map.keySet();
   assertEquals(5, s.size());
   assertTrue(s.contains(m1));
   assertTrue(s.contains(m2));
   assertTrue(s.contains(m3));
   assertTrue(s.contains(m4));
   assertTrue(s.contains(m5));
 }
 /** keySet returns a Set containing all the keys */
 public void testKeySet() {
   ConcurrentNavigableMap map = map5();
   Set s = map.keySet();
   assertEquals(5, s.size());
   assertTrue(s.contains(one));
   assertTrue(s.contains(two));
   assertTrue(s.contains(three));
   assertTrue(s.contains(four));
   assertTrue(s.contains(five));
 }