From 38cd46be411eae41d2f66ea0471b2f5b5b57fd7e Mon Sep 17 00:00:00 2001 From: Stefan Seifert Date: Mon, 15 Jan 2024 15:54:24 +0100 Subject: [PATCH] fix unit tests --- .../WebOptimizedImageDeliveryServiceImplTest.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/test/java/io/wcm/handler/mediasource/dam/impl/ngdm/WebOptimizedImageDeliveryServiceImplTest.java b/src/test/java/io/wcm/handler/mediasource/dam/impl/ngdm/WebOptimizedImageDeliveryServiceImplTest.java index d7d1ec1a..91e10f49 100644 --- a/src/test/java/io/wcm/handler/mediasource/dam/impl/ngdm/WebOptimizedImageDeliveryServiceImplTest.java +++ b/src/test/java/io/wcm/handler/mediasource/dam/impl/ngdm/WebOptimizedImageDeliveryServiceImplTest.java @@ -22,11 +22,9 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import io.wcm.handler.media.testcontext.AppAemContext; import io.wcm.testing.mock.aem.dam.MockAssetDelivery; import io.wcm.testing.mock.aem.junit5.AemContext; import io.wcm.testing.mock.aem.junit5.AemContextExtension; @@ -34,30 +32,25 @@ @ExtendWith(AemContextExtension.class) class WebOptimizedImageDeliveryServiceImplTest { - private final AemContext context = AppAemContext.newAemContext(); - - private WebOptimizedImageDeliveryService underTest; - - @BeforeEach - void setUp() { - underTest = context.getService(WebOptimizedImageDeliveryService.class); - } + private final AemContext context = new AemContext(); @Test void testEnabled_AssetDeliveryNotPresent() { + WebOptimizedImageDeliveryService underTest = context.registerInjectActivateService(WebOptimizedImageDeliveryServiceImpl.class); assertFalse(underTest.isEnabled()); } @Test void testEnabled_AssetDeliveryPresent() { context.registerInjectActivateService(MockAssetDelivery.class); + WebOptimizedImageDeliveryService underTest = context.registerInjectActivateService(WebOptimizedImageDeliveryServiceImpl.class); assertTrue(underTest.isEnabled()); } @Test void testEnabled_AssetDeliveryPresent_Disabled() { context.registerInjectActivateService(MockAssetDelivery.class); - underTest = context.registerInjectActivateService(WebOptimizedImageDeliveryServiceImpl.class, + WebOptimizedImageDeliveryService underTest = context.registerInjectActivateService(WebOptimizedImageDeliveryServiceImpl.class, "enabled", false); assertFalse(underTest.isEnabled()); }