Exemplo n.º 1
0
  @Test
  public void testOnRenamedOldNameEqualsDisplayName() throws Exception {
    DisplayNameListener listener = new DisplayNameListener();
    final String oldName = "old job name";
    final String newName = "new job name";
    StubJob src = new StubJob();
    src.doSetName(newName);
    src.setDisplayName(oldName);

    listener.onRenamed(src, oldName, newName);

    Assert.assertEquals(newName, src.getDisplayName());
  }
Exemplo n.º 2
0
  @Test
  public void testOnRenamedOldNameNotEqualDisplayName() throws Exception {
    DisplayNameListener listener = new DisplayNameListener();
    final String oldName = "old job name";
    final String newName = "new job name";
    final String displayName = "the display name";
    StubJob src = new StubJob();
    src.doSetName(newName);
    src.setDisplayName(displayName);

    listener.onRenamed(src, oldName, oldName);

    // make sure displayname is still intact
    Assert.assertEquals(displayName, src.getDisplayName());
  }
Exemplo n.º 3
0
  @Test
  public void testOnCopied() throws Exception {
    DisplayNameListener listener = new DisplayNameListener();
    StubJob src = new StubJob();
    src.doSetName("src");
    StubJob dest = new StubJob();
    dest.doSetName("dest");
    dest.setDisplayName("this should be cleared");

    // make sure the displayname and the name are different at this point
    Assert.assertFalse(dest.getName().equals(dest.getDisplayName()));

    listener.onCopied(src, dest);
    // make sure the displayname is equals to the name as it should be null
    Assert.assertEquals(dest.getName(), dest.getDisplayName());
  }