/** * Test lostOwnership, with correct clipboard and transferable. * * @throws Exception if an unexpected exception occurs */ public void testLostOwnership2() throws Exception { Generalization generalizationElement = new GeneralizationImpl(); ClassElementsTransfer classElementsTransfer = new ClassElementsTransfer(generalizationElement); Clipboard clipboard = new Clipboard("test clipboard"); classElementsTransfer.lostOwnership(clipboard, classElementsTransfer); // confirm the contents of the outputFile assertTrue(confirmFileContents("Clipboard test clipboard contains Generalization")); }
/** * Test lostOwnership, with correct clipboard and transferable. * * @throws Exception if an unexpected exception occurs */ public void testLostOwnership() throws Exception { Dependency dependencyElement = new DependencyImpl(); ClassElementsTransfer classElementsTransfer = new ClassElementsTransfer(dependencyElement); Clipboard clipboard = new Clipboard("test clipboard"); classElementsTransfer.lostOwnership(clipboard, classElementsTransfer); // confirm the contents of the outputFile assertTrue(confirmFileContents("Clipboard test clipboard contains Dependency")); }
/** Test lostOwnership, with null clipboard. IllegalArgumentException is expected. */ public void testLostOwnershipWithNullClipboard() { try { Generalization generalizationElement = new GeneralizationImpl(); ClassElementsTransfer classElementsTransfer = new ClassElementsTransfer(generalizationElement); classElementsTransfer.lostOwnership(null, classElementsTransfer); fail("IllegalArgumentException is expected."); } catch (IllegalArgumentException iae) { // pass } }