use of org.junit.jupiter.api.condition.EnabledForJreRange in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method implicitlyBoundRecordProperties.
@Test
@EnabledForJreRange(min = JRE.JAVA_16)
void implicitlyBoundRecordProperties(@TempDir File temp) throws IOException {
File exampleRecord = new File(temp, "ExampleRecord.java");
try (PrintWriter writer = new PrintWriter(new FileWriter(exampleRecord))) {
writer.println("@org.springframework.boot.configurationsample.ConfigurationProperties(\"implicit\")");
writer.println("public record ExampleRecord(String someString, Integer someInteger) {");
writer.println("}");
}
ConfigurationMetadata metadata = compile(exampleRecord);
assertThat(metadata).has(Metadata.withProperty("implicit.some-string"));
assertThat(metadata).has(Metadata.withProperty("implicit.some-integer"));
}
use of org.junit.jupiter.api.condition.EnabledForJreRange in project aeron by real-logic.
the class FailedFirstElectionClusterTest method shouldRecoverWhenFollowerIsMultipleTermsBehindFromEmptyLog.
@Test
@EnabledForJreRange(min = JRE.JAVA_11)
@InterruptAfter(60)
public void shouldRecoverWhenFollowerIsMultipleTermsBehindFromEmptyLog() {
final int numNodes = 3;
final int messageCount = 10;
final int numTerms = 3;
final TestCluster cluster = aCluster().withStaticNodes(numNodes).start(2);
systemTestWatcher.cluster(cluster);
systemTestWatcher.ignoreErrorsMatching((s) -> s.contains("Forced failure"));
int totalMessages = 0;
for (int i = 0; i < numTerms; i++) {
final TestNode oldLeader = cluster.awaitLeader();
cluster.connectClient();
cluster.sendMessages(messageCount);
totalMessages += messageCount;
cluster.awaitResponseMessageCount(totalMessages);
cluster.stopNode(oldLeader);
cluster.startStaticNode(oldLeader.index(), false);
cluster.awaitLeader();
}
cluster.startStaticNode(2, true);
cluster.connectClient();
cluster.sendMessages(messageCount);
totalMessages += messageCount;
cluster.awaitResponseMessageCount(totalMessages);
cluster.awaitServicesMessageCount(totalMessages);
cluster.assertRecordingLogsEqual();
}
use of org.junit.jupiter.api.condition.EnabledForJreRange in project mapstruct by mapstruct.
the class JodaConversionTest method testSourceToTargetMappingForStringsJdk11.
@ProcessorTest
@EnabledForJreRange(min = JRE.JAVA_11)
public // See https://bugs.openjdk.java.net/browse/JDK-8211262, there is a difference in the default formats on Java 9+
void testSourceToTargetMappingForStringsJdk11() {
Source src = new Source();
src.setLocalTime(new LocalTime(0, 0));
src.setLocalDate(new LocalDate(2014, 1, 1));
src.setLocalDateTime(new LocalDateTime(2014, 1, 1, 0, 0));
src.setDateTime(new DateTime(2014, 1, 1, 0, 0, 0, DateTimeZone.UTC));
// with given format
Target target = SourceTargetMapper.INSTANCE.sourceToTarget(src);
assertThat(target).isNotNull();
assertThat(target.getDateTime()).isEqualTo("01.01.2014 00:00 UTC");
assertThat(target.getLocalDateTime()).isEqualTo("01.01.2014 00:00");
assertThat(target.getLocalDate()).isEqualTo("01.01.2014");
assertThat(target.getLocalTime()).isEqualTo("00:00");
// and now with default mappings
target = SourceTargetMapper.INSTANCE.sourceToTargetDefaultMapping(src);
assertThat(target).isNotNull();
assertThat(target.getDateTime()).isEqualTo("1. Januar 2014 um 00:00:00 UTC");
assertThat(target.getLocalDateTime()).isEqualTo("1. Januar 2014 um 00:00:00");
assertThat(target.getLocalDate()).isEqualTo("1. Januar 2014");
assertThat(target.getLocalTime()).isEqualTo("00:00:00");
}
use of org.junit.jupiter.api.condition.EnabledForJreRange in project spring-boot by spring-projects.
the class ConfigurationMetadataAnnotationProcessorTests method multiConstructorRecordProperties.
@Test
@EnabledForJreRange(min = JRE.JAVA_16)
void multiConstructorRecordProperties(@TempDir File temp) throws IOException {
File exampleRecord = new File(temp, "ExampleRecord.java");
try (PrintWriter writer = new PrintWriter(new FileWriter(exampleRecord))) {
writer.println("@org.springframework.boot.configurationsample.ConfigurationProperties(\"multi\")");
writer.println("public record ExampleRecord(String someString, Integer someInteger) {");
writer.println(" @org.springframework.boot.configurationsample.ConstructorBinding");
writer.println(" public ExampleRecord(String someString) {");
writer.println(" this(someString, 42);");
writer.println(" }");
writer.println(" public ExampleRecord(Integer someInteger) {");
writer.println(" this(\"someString\", someInteger);");
writer.println(" }");
writer.println("}");
}
ConfigurationMetadata metadata = compile(exampleRecord);
assertThat(metadata).has(Metadata.withProperty("multi.some-string"));
assertThat(metadata).doesNotHave(Metadata.withProperty("multi.some-integer"));
}
use of org.junit.jupiter.api.condition.EnabledForJreRange in project zaproxy by zaproxy.
the class VerifyScriptTemplates method shouldParseJsTemplates.
@Test
@EnabledForJreRange(max = JRE.JAVA_14)
void shouldParseJsTemplates() throws Exception {
// Given
List<Path> templates = getScriptTemplates(".js");
Compilable se = (Compilable) new ScriptEngineManager().getEngineByName("ECMAScript");
assertThat("No ECMAScript script engine found.", se, is(not(nullValue())));
for (Path template : templates) {
try (Reader reader = Files.newBufferedReader(template, StandardCharsets.UTF_8)) {
// When / Then
se.compile(reader);
}
}
}
Aggregations