BAEL-6282 Add Native Image Condition (#13739)

This commit is contained in:
Eugene Kovko 2023-03-31 23:27:40 +02:00 committed by GitHub
parent ecad53efac
commit 7f6930e864
1 changed files with 13 additions and 12 deletions

View File

@ -2,18 +2,7 @@ package com.baeldung.junit5.conditional;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledForJreRange;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
import org.junit.jupiter.api.condition.DisabledOnJre;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.EnabledForJreRange;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
import org.junit.jupiter.api.condition.EnabledOnJre;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.JRE;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.api.condition.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -44,6 +33,18 @@ public class ConditionalAnnotationsUnitTest {
LOGGER.debug("runs with java 10 and 11");
}
@Test
@EnabledInNativeImage
void shouldOnlyRunWithinNativeImage() {
LOGGER.debug("Should run only within native images.");
}
@Test
@DisabledInNativeImage
void shouldNeverRunWithinNativeImage() {
LOGGER.debug("Shouldn't run within native images.");
}
@Test
@EnabledForJreRange(min = JRE.JAVA_8, max = JRE.JAVA_13)
public void shouldOnlyRunOnJava8UntilJava13() {