private void performDiagramTest( final NonRootModelElement element, int expectedGraphicalElementCount) { Model_c model = Model_c.ModelInstance( Ooaofgraphics.getInstance(element.getModelRoot().getId()), new ClassQueryInterface_c() { @Override public boolean evaluate(Object candidate) { return ((Model_c) candidate).getOoa_id().equals(element.Get_ooa_id()); } }); assertNotNull( "Could not locate diagram for element : " + element.getClass().getSimpleName(), model); // if the element is a package assert the Ooa type for the model if (element instanceof Package_c) { assertTrue( "Found a diagram representing a package with an improper ooa type.", model.getOoa_type() == Ooatype_c.Package); } GraphicalElement_c[] elements = GraphicalElement_c.getManyGD_GEsOnR1(model); assertEquals( "Did not find the expected graphical element count for : " + element.getClass().getSimpleName(), expectedGraphicalElementCount, elements.length); for (GraphicalElement_c ge : elements) { // if the represents value is a package assert the proper ooa type if (ge.getRepresents() instanceof Package_c) { assertTrue( "Found a graphical element representing a package with an improper ooa type.", ge.getOoa_type() == Ooatype_c.Package); } } }
public static boolean differenceElementIsGraphical(Object diffElement) { if (diffElement instanceof ObjectElementComparable) { ObjectElementComparable comparable = (ObjectElementComparable) diffElement; if (comparable.getRealElement() instanceof ObjectElement) { ObjectElement objEle = (ObjectElement) comparable.getRealElement(); if (objEle.getParent() instanceof NonRootModelElement) { NonRootModelElement nrme = (NonRootModelElement) objEle.getParent(); if (nrme.getModelRoot() instanceof Ooaofgraphics) { return true; } } } } if (diffElement instanceof NonRootModelElementComparable) { NonRootModelElementComparable comparable = (NonRootModelElementComparable) diffElement; if (comparable.getRealElement() instanceof NonRootModelElement) { NonRootModelElement nrme = (NonRootModelElement) comparable.getRealElement(); if (nrme.getModelRoot() instanceof Ooaofgraphics) { return true; } } } return false; }