### Question:
ScanProjectConfigService { public ScanProjectConfig get(String projectId, ScanProjectConfigID configId) { return get(projectId, configId, true); }  ScanProjectConfig get(String projectId, ScanProjectConfigID configId); ScanProjectConfig getOrCreate(String projectId, ScanProjectConfigID configId, boolean checkAccess, String defaultData); ScanProjectConfig get(String projectId, ScanProjectConfigID configId, boolean checkAccess); void set(String projectId, ScanProjectConfigID configId, String data);  }### Answer:
@Test public void ensures_projectid_valid() { toTest.get("project-id1", ScanProjectConfigID.MOCK_CONFIGURATION); verify(toTest.userInputAssertion).isValidProjectId(eq("project-id1")); }
@Test public void ensures_user_has_access_without_check_access_param() { toTest.get("project-id1", ScanProjectConfigID.MOCK_CONFIGURATION); verify(toTest.scanAssertService).assertUserHasAccessToProject("project-id1"); }
@Test public void ensures_user_has_access_with_param_true() { toTest.get("project-id1", ScanProjectConfigID.MOCK_CONFIGURATION,true); verify(toTest.scanAssertService).assertUserHasAccessToProject("project-id1"); }
@Test public void does_NOT_ensures_user_has_access_with_param_false() { toTest.get("project-id1", ScanProjectConfigID.MOCK_CONFIGURATION,false); verify(toTest.scanAssertService,never()).assertUserHasAccessToProject("project-id1"); }
@Test public void fetches_data_from_repository() { ScanProjectConfig result = toTest.get("project-id1", ScanProjectConfigID.MOCK_CONFIGURATION); assertNotNull(result);; assertEquals("configData", result.getData()); }
@Test public void fetches_null_when_no_config_found() { ScanProjectConfig result = toTest.get("project-id2", ScanProjectConfigID.MOCK_CONFIGURATION); assertNull(result);; }