]> source.dussan.org Git - sonarqube.git/commitdiff
Fix UT on Oracle
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 4 Mar 2019 13:30:34 +0000 (14:30 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 6 Mar 2019 10:30:44 +0000 (11:30 +0100)
server/sonar-db-dao/src/test/java/org/sonar/db/alm/OrganizationAlmBindingDaoTest.java

index a390b8327e1a117b5c05c4abd49a316c0dce91b7..b104f9a6dd4cac962ba9039c9211fa1f8bd1057b 100644 (file)
@@ -33,7 +33,6 @@ import org.sonar.db.user.UserDto;
 import static java.util.Arrays.asList;
 import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.entry;
 import static org.assertj.core.groups.Tuple.tuple;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -173,21 +172,11 @@ public class OrganizationAlmBindingDaoTest {
 
     underTest.insert(db.getSession(), organization, almAppInstall, "http://myorg.com", user.getUuid(), true);
 
-    assertThat(db.selectFirst(db.getSession(),
-      "select" +
-        "   uuid as \"uuid\", organization_uuid as \"organizationUuid\", alm_app_install_uuid as \"almAppInstallUuid\", url as \"url\", alm_id as \"almId\"," +
-        " user_uuid as \"userUuid\", members_sync_enabled as \"membersSync\", created_at as \"createdAt\"" +
-        " from organization_alm_bindings" +
-        "   where organization_uuid='" + organization.getUuid() + "'"))
-          .contains(
-            entry("uuid", "ABCD"),
-            entry("organizationUuid", organization.getUuid()),
-            entry("almAppInstallUuid", almAppInstall.getUuid()),
-            entry("almId", "github"),
-            entry("url", "http://myorg.com"),
-            entry("userUuid", user.getUuid()),
-            entry("createdAt", NOW),
-            entry("membersSync", true));
+    assertThat(underTest.selectByOrganizationUuid(db.getSession(), organization.getUuid()).get())
+      .extracting(OrganizationAlmBindingDto::getUuid, OrganizationAlmBindingDto::getOrganizationUuid, OrganizationAlmBindingDto::getAlmAppInstallUuid,
+        OrganizationAlmBindingDto::getAlm,
+        OrganizationAlmBindingDto::getUrl, OrganizationAlmBindingDto::getUserUuid, OrganizationAlmBindingDto::isMembersSyncEnable, OrganizationAlmBindingDto::getCreatedAt)
+      .containsExactlyInAnyOrder("ABCD", organization.getUuid(), almAppInstall.getUuid(), GITHUB, "http://myorg.com", user.getUuid(), true, NOW);
   }
 
   @Test