*/
package org.sonar.db.organization;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
}
public List<OrganizationDto> selectByUuids(DbSession dbSession, Set<String> organizationUuids) {
- if (organizationUuids.size() == 1) {
- return Collections.singletonList(getMapper(dbSession).selectByUuid(organizationUuids.iterator().next()));
- }
return executeLargeInputs(organizationUuids, getMapper(dbSession)::selectByUuids);
}
.isEmpty();
}
+ @Test
+ public void selectByUuids_returns_empty_when_no_single_uuid_exist() {
+ insertOrganization(ORGANIZATION_DTO_1);
+ insertOrganization(ORGANIZATION_DTO_2);
+
+ assertThat(underTest.selectByUuids(dbSession, of("foo uuid")))
+ .isEmpty();
+ }
+
@Test
public void selectByUuids_ignores_non_existing_uuids() {
insertOrganization(ORGANIZATION_DTO_1);