From 3356868bf0180418546ec51b5e0fd2c92e88f9fb Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Mon, 17 Jun 2024 16:45:55 +0200 Subject: [PATCH] fixing code-review-issues --- ...HostingAssetRepositoryIntegrationTest.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepositoryIntegrationTest.java b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepositoryIntegrationTest.java index 25f73d9f..480f9416 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepositoryIntegrationTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/hosting/asset/HsHostingAssetRepositoryIntegrationTest.java @@ -154,8 +154,11 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu } private void assertThatAssetIsPersisted(final HsHostingAssetEntity saved) { - final var found = assetRepo.findByUuid(saved.getUuid()); - assertThat(found).isNotEmpty().map(HsHostingAssetEntity::getVersion).get().isEqualTo(saved.getVersion()); + attempt(em, () -> { + context("superuser-alex@hostsharing.net"); + final var found = assetRepo.findByUuid(saved.getUuid()); + assertThat(found).isNotEmpty().map(HsHostingAssetEntity::toString).get().isEqualTo(saved.toString()); + }); } } @@ -178,14 +181,6 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu "HsHostingAssetEntity(MANAGED_WEBSPACE, thi01, some Webspace, MANAGED_SERVER:vm1013, D-1000313:D-1000313 default project:separate ManagedWebspace)"); } - public R stopWatch(final String caption, final Supplier operation) { - long start = System.nanoTime(); - final R result = operation.get(); - System.out.printf("StopWatch %s: %dms\n", - caption, TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start)); - return result; - } - @Test public void normalUser_canViewOnlyRelatedAsset() { // given: @@ -194,9 +189,7 @@ class HsHostingAssetRepositoryIntegrationTest extends ContextBasedTestWithCleanu .findAny().orElseThrow().getUuid(); // when: - final var result = stopWatch("findAllByCriteria", () -> - assetRepo.findAllByCriteria(projectUuid, null, null) - ); + final var result = assetRepo.findAllByCriteria(projectUuid, null, null); // then: exactlyTheseAssetsAreReturned(