use of org.junit.jupiter.api.condition.DisabledForJreRange in project logging-log4j2 by apache.
the class AbstractScriptFilterTest method testJavascriptFilter.
@Test
@DisabledForJreRange(min = JRE.JAVA_15, disabledReason = "JEP 372: Remove the Nashorn JavaScript Engine")
public void testJavascriptFilter(final LoggerContext context, @Named("List") final ListAppender app) throws Exception {
final Logger logger = context.getLogger("TestJavaScriptFilter");
logger.traceEntry();
logger.info("This should not be logged");
ThreadContext.put("UserId", "JohnDoe");
logger.info("This should be logged");
ThreadContext.clearMap();
final List<String> messages = app.getMessages();
try {
assertNotNull(messages, "No Messages");
assertEquals(messages.size(), 2, "Incorrect number of messages. Expected 2, Actual " + messages.size());
} finally {
app.clear();
}
}
use of org.junit.jupiter.api.condition.DisabledForJreRange in project dropwizard by dropwizard.
the class HttpsConnectorFactoryTest method testExcludedProtocolsJava16.
@Test
@DisabledForJreRange(max = JRE.JAVA_15)
void testExcludedProtocolsJava16() throws Exception {
List<String> excludedProtocols = Arrays.asList("SSLv3", "TLSv1");
HttpsConnectorFactory factory = new HttpsConnectorFactory();
// necessary to avoid a prompt for a password
factory.setKeyStorePassword("password");
factory.setExcludedProtocols(excludedProtocols);
SslContextFactory sslContextFactory = factory.configureSslContextFactory(new SslContextFactory.Server());
assertThat(Arrays.asList(sslContextFactory.getExcludeProtocols())).isEqualTo(excludedProtocols);
sslContextFactory.start();
try {
assertThat(sslContextFactory.newSSLEngine().getEnabledProtocols()).contains("TLSv1.2", "TLSv1.3").doesNotContain("SSLv3", "TLSv1");
} finally {
sslContextFactory.stop();
}
}
Aggregations