StubResourceHolderUpdater { public void updateResourceHolder() { stubResourceHolder.setConditionChekers(new ArrayList<>(temporaryStubResourceHolder.getConditionCheckers())); stubResourceHolder.setResponseFormatters(new ArrayList<>(temporaryStubResourceHolder.getResponseFormatters())); stubResourceHolder.setTemplates(new HashMap<>(temporaryStubResourceHolder.getTemplates())); updateRequestInterceptors(); updateResponseInterceptors(); stubResourceHolder.setSequenceHandlers(new ArrayList<>(temporaryStubResourceHolder.getSequenceHandlers())); }  void updateResourceHolder(); void clearTemporaryResourceHolder(); void addDocumentToResourceHolder(final String groupName, final Document document); void addDocumentToResourceHolder(final String groupName, final JSONObject jsonObject); void initializeTemporaryResourceHolder();  }
@Test public void testUpdateResourceHolderShouldSetResources() { List<ConditionChecker> conditionCheckers = new ArrayList<>(); List<ResponseFormatter> templateFormatters = new ArrayList<>(); Map<String, byte[]> templates = new HashMap<>(); List<RequestInterceptor> requestInterceptors = new ArrayList<>(); List<ResponseInterceptor> responseInterceptors = new ArrayList<>(); List<SequenceHandler> sequenceHandlers = new ArrayList<>(); given(temporaryStubResourceHolder.getConditionCheckers()).willReturn(conditionCheckers); given(temporaryStubResourceHolder.getResponseFormatters()).willReturn(templateFormatters); given(temporaryStubResourceHolder.getTemplates()).willReturn(templates); given(temporaryStubResourceHolder.getRequestInterceptors()).willReturn(requestInterceptors); given(temporaryStubResourceHolder.getResponseInterceptors()).willReturn(responseInterceptors); given(temporaryStubResourceHolder.getSequenceHandlers()).willReturn(sequenceHandlers); underTest.updateResourceHolder(); verify(stubResourceHolder).setConditionChekers(conditionCheckers); verify(stubResourceHolder).setResponseFormatters(templateFormatters); verify(stubResourceHolder).setTemplates(templates); verify(stubResourceHolder).setRequestInterceptors(requestInterceptors); verify(stubResourceHolder).setResponseInterceptors(responseInterceptors); verify(stubResourceHolder).setSequenceHandlers(sequenceHandlers); }
@Test public void testUpdateResourceHolderWhenNoRequestInterceptorsShouldNotSetInterceptors() { given(temporaryStubResourceHolder.getRequestInterceptors()).willReturn(null); underTest.updateResourceHolder(); verify(stubResourceHolder, BDDMockito.never()).setRequestInterceptors(null); }
@Test public void testUpdateResourceHolderWhenNoResponseInterceptorsShouldNotSetInterceptors() { given(temporaryStubResourceHolder.getResponseInterceptors()).willReturn(null); underTest.updateResourceHolder(); verify(stubResourceHolder, BDDMockito.never()).setRequestInterceptors(null); }