Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Jan 15, 2024
1 parent a8916f2 commit 38cd46b
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,42 +22,35 @@
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;

@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());
}
Expand Down

0 comments on commit 38cd46b

Please sign in to comment.