Source:
public void createAppConfig() { when(mockStudyService.getStudy(TEST_STUDY)).thenReturn(study); when(mockSchemaService.getUploadSchemaByIdAndRev(any(), any(), anyInt())).thenReturn(mockUploadSchema); when(mockSurveyService.getSurvey(any(), any(), anyBoolean(), anyBoolean())).thenReturn(mockSurvey); when(mockAppConfigElementService.getElementRevision(any(), any(), anyLong())).thenReturn(mockConfigElement); when(mockSurvey.isPublished()).thenReturn(true); AppConfig newConfig = setupAppConfig(); newConfig.setClientData(TestUtils.getClientData()); newConfig.setSurveyReferences(ImmutableList.of(new SurveyReference("id", "guid", DateTime.now()))); newConfig.setSchemaReferences(ImmutableList.of(new SchemaReference("id", 1 ))); newConfig.setConfigReferences(ImmutableList.of(new ConfigReference("id", 1L))); AppConfig returnValue = service.createAppConfig(TEST_STUDY, newConfig); assertEquals(TIMESTAMP.getMillis(), returnValue.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), returnValue.getModifiedOn()); assertEquals(GUID, returnValue.getGuid()); assertEquals(newConfig.getLabel(), returnValue.getLabel()); assertEquals(TEST_STUDY.getIdentifier(), returnValue.getStudyId()); assertNotNull(returnValue.getClientData()); assertNotNull(returnValue.getSurveyReferences()); assertNotNull(returnValue.getSchemaReferences()); assertNotNull(returnValue.getConfigReferences()); verify(mockDao).createAppConfig(appConfigCaptor.capture()); AppConfig captured = appConfigCaptor.getValue(); assertEquals(TIMESTAMP.getMillis(), captured.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), captured.getModifiedOn()); assertEquals(GUID, captured.getGuid()); }

Target:
public void createAppConfig() { when(mockStudyService.getStudy(TEST_STUDY)).thenReturn(study); when(mockSchemaService.getUploadSchemaByIdAndRev(any(), any(), anyInt())).thenReturn(mockUploadSchema); when(mockSurveyService.getSurvey(any(), any(), anyBoolean(), anyBoolean())).thenReturn(mockSurvey); when(mockAppConfigElementService.getElementRevision(any(), any(), anyLong())).thenReturn(mockConfigElement); when(mockSurvey.isPublished()).thenReturn(true); AppConfig newConfig = setupAppConfig(); newConfig.setClientData(TestUtils.getClientData()); newConfig.setSurveyReferences(SURVEY_REF_LIST); newConfig.setSchemaReferences(SCHEMA_REF_LIST); newConfig.setConfigReferences(CONFIG_REF_LIST); AppConfig returnValue = service.createAppConfig(TEST_STUDY, newConfig); assertEquals(TIMESTAMP.getMillis(), returnValue.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), returnValue.getModifiedOn()); assertEquals(GUID, returnValue.getGuid()); assertEquals(newConfig.getLabel(), returnValue.getLabel()); assertEquals(TEST_STUDY.getIdentifier(), returnValue.getStudyId()); assertEquals(TestUtils.getClientData(), returnValue.getClientData()); assertEquals(SURVEY_REF_LIST, returnValue.getSurveyReferences()); assertEquals(SCHEMA_REF_LIST, returnValue.getSchemaReferences()); assertEquals(CONFIG_REF_LIST, returnValue.getConfigReferences()); verify(mockDao).createAppConfig(appConfigCaptor.capture()); AppConfig captured = appConfigCaptor.getValue(); assertEquals(TIMESTAMP.getMillis(), captured.getCreatedOn()); assertEquals(TIMESTAMP.getMillis(), captured.getModifiedOn()); assertEquals(GUID, captured.getGuid()); }