From 461973f1e0aedf5fba3ecc5438e324c3921c5883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C3=B6=C3=9Fmann?= Date: Tue, 14 Jan 2025 18:26:13 +0100 Subject: [PATCH] Cleanes lazy fetch test up --- ...ava => LearnerProfileIntegrationTest.java} | 26 +++++-------------- 1 file changed, 6 insertions(+), 20 deletions(-) rename src/test/java/de/tum/cit/aet/artemis/atlas/profile/{LearnerProfileArchitectureTest.java => LearnerProfileIntegrationTest.java} (50%) diff --git a/src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.java b/src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java similarity index 50% rename from src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.java rename to src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java index 437537b1f926..da34711b17fd 100644 --- a/src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileArchitectureTest.java +++ b/src/test/java/de/tum/cit/aet/artemis/atlas/profile/LearnerProfileIntegrationTest.java @@ -2,30 +2,16 @@ import de.tum.cit.aet.artemis.atlas.AbstractAtlasIntegrationTest; import de.tum.cit.aet.artemis.core.domain.User; -import de.tum.cit.aet.artemis.shared.TestRepositoryConfiguration; -import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import org.hibernate.Hibernate; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; import org.springframework.security.test.context.support.WithMockUser; -import org.springframework.test.context.junit.jupiter.SpringExtension; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -@SpringBootTest -@AutoConfigureMockMvc -@ExtendWith(SpringExtension.class) -@Execution(ExecutionMode.CONCURRENT) -@Import(TestRepositoryConfiguration.class) -@AutoConfigureEmbeddedDatabase -public class LearnerProfileArchitectureTest extends AbstractAtlasIntegrationTest { - private static final String TEST_PREFIX = "learningpathintegration"; +public class LearnerProfileIntegrationTest extends AbstractAtlasIntegrationTest { + + private static final String TEST_PREFIX = "learnerprofiledatabase"; private static final int NUMBER_OF_STUDENTS = 1; @@ -45,8 +31,8 @@ void setupTestScenario() { @Test @WithMockUser(username = STUDENT1_OF_COURSE, roles = "USER") - void testAll_asStudent() { + void testLazyFetchLearnerProfile() { User user = userTestRepository.getUserWithGroupsAndAuthorities(STUDENT1_OF_COURSE); - assertFalse(Hibernate.isInitialized(user.getLearnerProfile())); + assertThat(Hibernate.isInitialized(user.getLearnerProfile())).isFalse(); } }