### Question:
FixedFlowController extends CasFlowController_ImplBase { public static FlowControllerDescription getDescription() { FlowControllerDescription desc = getResourceSpecifierFactory().createFlowControllerDescription(); desc.setImplementationName(FixedFlowController.class.getName()); ProcessingResourceMetaData metaData = desc.getFlowControllerMetaData(); metaData.setName("Fixed Flow Controller"); metaData.setDescription("Simple FlowController that uses the FixedFlow element of the\n" + "\t\taggregate descriptor to determine a linear flow."); metaData.setVendor("The Apache Software Foundation"); metaData.setVersion("1.0"); Capability capability = getResourceSpecifierFactory().createCapability(); metaData.setCapabilities(new Capability[] { capability }); ConfigurationParameter param = getResourceSpecifierFactory().createConfigurationParameter(); param.setName("ActionAfterCasMultiplier"); param.setType("String"); param.setDescription("The action to be taken after a CAS has been input to a CAS Multiplier and the CAS Multiplier has finished processing it.\n" + "\t\t Valid values are:\n" + "\t\t\tcontinue - the CAS continues on to the next element in the flow\n" + "\t\t\tstop - the CAS will no longer continue in the flow, and will be returned from the aggregate if possible.\n" + "\t\t\tdrop - the CAS will no longer continue in the flow, and will be dropped (not returned from the aggregate) if possible.\t \n" + "\t\t\tdropIfNewCasProduced (the default) - if the CAS multiplier produced a new CAS as a result of processing this CAS, then this\n" + "\t\t\t\tCAS will be dropped. If not, then this CAS will continue."); ConfigurationParameterDeclarations parameterDeclarations = getResourceSpecifierFactory().createConfigurationParameterDeclarations(); parameterDeclarations.setConfigurationParameters(new ConfigurationParameter[] { param }); metaData.setConfigurationParameterDeclarations(parameterDeclarations); NameValuePair paramSetting = getResourceSpecifierFactory().createNameValuePair(); paramSetting.setName("ActionAfterCasMultiplier"); paramSetting.setValue("dropIfNewCasProduced"); ConfigurationParameterSettings parameterSettings = getResourceSpecifierFactory().createConfigurationParameterSettings(); parameterSettings.setParameterSettings(new NameValuePair[] { paramSetting }); metaData.setConfigurationParameterSettings(parameterSettings); return desc; }  @Override synchronized void initialize(FlowControllerContext aContext); @Override Flow computeFlow(CAS aCAS); @Override void addAnalysisEngines(Collection<String> aKeys); @Override void removeAnalysisEngines(Collection<String> aKeys); static FlowControllerDescription getDescription(); static FlowControllerDescription makeDefaultDescription(); static final String PARAM_ACTION_AFTER_CAS_MULTIPLIER; }### Answer:
@Test public void thatGeneratedDefaultFlowDescriptionIsEqualToXmlDescription() throws Exception { FlowControllerDescription desc1 = FixedFlowController.getDescription(); FlowControllerDescription desc2 = getXMLParser().parseFlowControllerDescription( new XMLInputSource("src/test/resources/FixedFlowControllerTest/FixedFlowController.xml")); StringWriter desc1Writer = new StringWriter(); desc1.toXML(desc1Writer); StringWriter desc2Writer = new StringWriter(); desc2.toXML(desc2Writer); assertThat(desc2.toString()).isEqualTo(desc1.toString()); }
@Test public void thatChangesToDefaultFlowControllerDoNotCarryOver() throws Exception { FlowControllerDescription desc1 = FixedFlowController.getDescription(); desc1.setImplementationName("otherImplementation"); desc1.getMetaData().setName("otherName"); FlowControllerDescription desc2 = FixedFlowController.getDescription(); assertThat(desc2.getImplementationName()).isEqualTo(FixedFlowController.class.getName()); assertThat(desc2.getMetaData().getName()).isEqualTo("Fixed Flow Controller"); }