ConfigurationAlgorithm { public static Set<Gateway> findConfiguredGateways(final Definitions definitions) { final Set<Gateway> reconfiguredGatewaySet = new HashSet<Gateway>(); for (BPMNDiagram bpmnDiagram : definitions.getDiagram()) { for (DiagramElement element : bpmnDiagram.getBPMNPlane().getDiagramElement()) { element.acceptVisitor(new AbstractVisitor() { @Override public void visitBpmnShape(final BPMNShape that) { super.visitBpmnShape(that); that.getBpmnElement().acceptVisitor(this); } @Override public void visitGateway(final Gateway that) { super.visitBaseElement(that); if (gatewayConfigurationType(that) != null) { reconfiguredGatewaySet.add(that); } } }); } } return reconfiguredGatewaySet; }  static void configure(final Definitions definitions); static Map<BaseElement, DiagramElement> findBpmndiMap(final Definitions definitions); static Set<Gateway> findConfiguredGateways(final Definitions definitions); static Set<SequenceFlow> findAbsentSequenceFlows(final Set<Gateway> reconfiguredGatewaySet); static void main(final String[] arg);  }
@Test public final void testFindConfiguredGateways1() throws JAXBException { Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setProperty(IDResolver.class.getName(), new DefinitionsIDResolver()); Definitions definitions = (Definitions) unmarshaller.unmarshal(test1File); Set<Gateway> configuredGateways = ConfigurationAlgorithm.findConfiguredGateways(definitions); assertEquals(configuredGateways.size(), 1); Iterator<Gateway> i = configuredGateways.iterator(); assertTrue(i.hasNext()); Gateway gateway = i.next(); assertEquals("sid-B044A443-736E-495B-9DD8-90EB4860F9AC", gateway.getId()); assertFalse(i.hasNext()); }