/** * Tests AssociationCompartmentExtractor#extractName() for failure. * * <p>Expects CompartmentMalformedException. * * @throws Exception to JUnit */ public void testExtractName_CompartmentMalformedException() throws Exception { GraphElement element = (GraphElement) edge.getContaineds().get(2); element.setSemanticModel(TestHelper.createSimpleSemanticModel("Invalid")); try { extractor.extractName(); fail("CompartmentMalformedException expected."); } catch (CompartmentMalformedException e) { // good } }
/** * Tests AssociationCompartmentExtractor#updateSecondAssociationEnd(GraphElement) for failure. * * <p>Expects CompartmentMalformedException. * * @throws Exception to JUnit */ public void testUpdateSecondAssociationEnd_CompartmentMalformedException() throws Exception { GraphElement element = (GraphElement) edge.getContaineds().get(1); element.setSemanticModel(TestHelper.createSimpleSemanticModel("Invalid")); try { extractor.updateSecondAssociationEnd(getAssociationEndNodeForUpdate()); fail("CompartmentMalformedException expected."); } catch (CompartmentMalformedException e) { // good } }
/** * Creates a new GraphNode instance for stereotype compartment to update. * * @return a new GraphNode instance for stereotype compartment to update. */ private GraphNode getStereotypeNodeForUpdate() { GraphNode stereotypeNode = new GraphNode(); stereotypeNode.setSemanticModel(TestHelper.createSimpleSemanticModel("StereotypeCompartment")); return stereotypeNode; }
/** * Creates a new GraphNode instance for name compartment to update. * * @return a new GraphNode instance for name compartment to update. */ private GraphNode getNameNodeForUpdate() { GraphNode nameNode = new GraphNode(); nameNode.setSemanticModel(TestHelper.createSimpleSemanticModel("Name")); return nameNode; }
/** * Creates a new GraphNode instance for association end compartment to update. * * @return a new GraphNode instance for association end compartment to update. */ private GraphNode getAssociationEndNodeForUpdate() { GraphNode node = new GraphNode(); node.setSemanticModel(TestHelper.createUmlSemanticModel(new AssociationEndImpl())); return node; }
/** Setup test environment. */ protected void setUp() { edge = TestHelper.createGraphEdgeForAssociation(); extractor = new AssociationCompartmentExtractor(edge); }