@Test public void first_enricher_returns_result_is_the_return_value() { Object enricherAResult = new Object(); when(mockEnricherA.enrich(this.request, null)).thenReturn(enricherAResult); Object result = compositeEnricher.enrich(this.request, null); assertSame(enricherAResult, result); }
@Override public Object enrich(Object request, Annotation annotation) { for( RequestEnricher enricher : this.enrichers) { Object newRequest = enricher.enrich(request, annotation); if(newRequest != null) { return newRequest; } } return null; }
CompositeRequestEnricher implements RequestEnricher { @Override public Object enrich(Object request, Annotation annotation) { for( RequestEnricher enricher : this.enrichers) { Object newRequest = enricher.enrich(request, annotation); if(newRequest != null) { return newRequest; } } return null; } }
CompositeRequestEnricher implements RequestEnricher { @Override public Object enrich(Object request, Annotation annotation) { for( RequestEnricher enricher : this.enrichers) { Object newRequest = enricher.enrich(request, annotation); if(newRequest != null) { return newRequest; } } return null; } CompositeRequestEnricher(RequestEnricher... enrichers); }
CompositeRequestEnricher implements RequestEnricher { @Override public Object enrich(Object request, Annotation annotation) { for( RequestEnricher enricher : this.enrichers) { Object newRequest = enricher.enrich(request, annotation); if(newRequest != null) { return newRequest; } } return null; } CompositeRequestEnricher(RequestEnricher... enrichers); @Override Object enrich(Object request, Annotation annotation); }
CompositeRequestEnricher implements RequestEnricher { @Override public Object enrich(Object request, Annotation annotation) { for( RequestEnricher enricher : this.enrichers) { Object newRequest = enricher.enrich(request, annotation); if(newRequest != null) { return newRequest; } } return null; } CompositeRequestEnricher(RequestEnricher... enrichers); @Override Object enrich(Object request, Annotation annotation);  }