示例#1
0
  @Test
  public void testAbbrevOrderBHasSameResolutionAsAbbrevOrderA() throws Exception {
    NameAbbrevService s =
        new NameAbbrevService(
            new String[] {"de.fau.cs.osr.utils.test1", "de.fau.cs.osr.utils.test2"});

    assertThat(s.abbrev(clazz2B), equalTo(abbrev2B));
    assertThat(s.abbrev(clazz2C), equalTo(abbrev2C));
    assertThat(s.abbrev(clazz1A), equalTo(abbrev1A));
    assertThat(s.abbrev(clazz1B), equalTo(abbrev1B));

    assertThat(s.resolve(abbrev2B), equalTo(clazz2B));
    assertThat(s.resolve(abbrev2C), equalTo(clazz2C));
    assertThat(s.resolve(abbrev1A), equalTo(clazz1A));
    assertThat(s.resolve(abbrev1B), equalTo(clazz1B));
  }
示例#2
0
  @Test
  public void testOtherPackgeOrderHasDifferentResolution() throws Exception {
    Class clazz1B = de.fau.cs.osr.utils.test1.ClassB.class;
    Class clazz2B = de.fau.cs.osr.utils.test2.ClassB.class;

    String abbrev1B = "de.fau.cs.osr.utils.test1.ClassB";
    String abbrev2B = "ClassB";

    NameAbbrevService s =
        new NameAbbrevService(
            new String[] {"de.fau.cs.osr.utils.test2", "de.fau.cs.osr.utils.test1"});

    assertThat(s.abbrev(clazz1B), equalTo(abbrev1B));
    assertThat(s.abbrev(clazz2B), equalTo(abbrev2B));

    assertThat(s.resolve(abbrev1B), equalTo(clazz1B));
    assertThat(s.resolve(abbrev2B), equalTo(clazz2B));
  }