@Test public void modulesAreCascaded() throws Exception { this.moduleList = Arrays.asList(this.moduleOne, this.moduleTwo, this.moduleThree); doReturn(this.moduleList).when(this.modules).get(); RecordConfiguration tempConfig = Mockito.mock(RecordConfiguration.class); when(this.moduleOne.process(any(RecordConfiguration.class))).thenReturn(null); when(this.moduleTwo.process(null)).thenReturn(tempConfig); when(this.moduleThree.process(tempConfig)).thenReturn(this.config); Assert.assertSame(this.config, this.mocker.getComponentUnderTest().getConfiguration(PATIENT_LABEL)); InOrder order = Mockito.inOrder(this.moduleOne, this.moduleTwo, this.moduleThree); order.verify(this.moduleOne).process(any(RecordConfiguration.class)); order.verify(this.moduleTwo).process(null); order.verify(this.moduleThree).process(tempConfig); }
@Override public RecordConfiguration getConfiguration(String recordType) { RecordConfiguration config = new DefaultRecordConfiguration(); for (RecordConfigurationModule service : this.modules.get()) { try { if (service.supportsRecordType(recordType)) { config = service.process(config); } } catch (Exception ex) { this.logger.warn("Failed to read the record configuration: {}", ex.getMessage()); } } return config; }
DefaultRecordConfigurationManager implements RecordConfigurationManager { @Override public RecordConfiguration getConfiguration(String recordType) { RecordConfiguration config = new DefaultRecordConfiguration(); for (RecordConfigurationModule service : this.modules.get()) { try { if (service.supportsRecordType(recordType)) { config = service.process(config); } } catch (Exception ex) { this.logger.warn("Failed to read the record configuration: {}", ex.getMessage()); } } return config; } }
DefaultRecordConfigurationManager implements RecordConfigurationManager { @Override public RecordConfiguration getConfiguration(String recordType) { RecordConfiguration config = new DefaultRecordConfiguration(); for (RecordConfigurationModule service : this.modules.get()) { try { if (service.supportsRecordType(recordType)) { config = service.process(config); } } catch (Exception ex) { this.logger.warn("Failed to read the record configuration: {}", ex.getMessage()); } } return config; }  }
DefaultRecordConfigurationManager implements RecordConfigurationManager { @Override public RecordConfiguration getConfiguration(String recordType) { RecordConfiguration config = new DefaultRecordConfiguration(); for (RecordConfigurationModule service : this.modules.get()) { try { if (service.supportsRecordType(recordType)) { config = service.process(config); } } catch (Exception ex) { this.logger.warn("Failed to read the record configuration: {}", ex.getMessage()); } } return config; }  @Override RecordConfiguration getConfiguration(String recordType); @Override RecordConfiguration getActiveConfiguration(); }
DefaultRecordConfigurationManager implements RecordConfigurationManager { @Override public RecordConfiguration getConfiguration(String recordType) { RecordConfiguration config = new DefaultRecordConfiguration(); for (RecordConfigurationModule service : this.modules.get()) { try { if (service.supportsRecordType(recordType)) { config = service.process(config); } } catch (Exception ex) { this.logger.warn("Failed to read the record configuration: {}", ex.getMessage()); } } return config; }  @Override RecordConfiguration getConfiguration(String recordType); @Override RecordConfiguration getActiveConfiguration();  }