@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()); }