Updating jetty-test-helper + junit5 + hamcrest

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-04-30 12:23:55 -05:00
parent c33f3a75ed
commit 2b93a4e7ea
10 changed files with 11 additions and 61 deletions

View File

@ -18,29 +18,24 @@
package org.eclipse.jetty.http;
import org.eclipse.jetty.http.matchers.HttpFieldsContainsHeaderValue;
import org.eclipse.jetty.http.matchers.HttpFieldsContainsHeaderKey;
import org.hamcrest.Factory;
import org.eclipse.jetty.http.matchers.HttpFieldsContainsHeaderValue;
import org.hamcrest.Matcher;
public class HttpFieldsMatchers
{
@Factory
public static Matcher<HttpFields> containsHeader(String keyName) {
return new HttpFieldsContainsHeaderKey(keyName);
}
@Factory
public static Matcher<HttpFields> containsHeader(HttpHeader header) {
return new HttpFieldsContainsHeaderKey(header);
}
@Factory
public static Matcher<HttpFields> containsHeaderValue(String keyName, String value) {
return new HttpFieldsContainsHeaderValue(keyName, value);
}
@Factory
public static Matcher<HttpFields> containsHeaderValue(HttpHeader header, String value) {
return new HttpFieldsContainsHeaderValue(header, value);
}

View File

@ -21,7 +21,6 @@ package org.eclipse.jetty.http.matchers;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeader;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
@ -51,7 +50,6 @@ public class HttpFieldsContainsHeaderKey extends TypeSafeMatcher<HttpFields>
return fields.containsKey(this.keyName);
}
@Factory
public static Matcher<HttpFields> containsKey(String keyName) {
return new HttpFieldsContainsHeaderKey(keyName);
}

View File

@ -105,11 +105,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -66,10 +66,5 @@
<version>${infinispan.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -138,11 +138,6 @@
<artifactId>infinispan-remote-query-client</artifactId>
<version>${infinispan.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>

View File

@ -18,10 +18,6 @@
package org.eclipse.jetty.server.session.infinispan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.lang.annotation.ElementType;
@ -43,19 +39,19 @@ import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;
import org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller;
import org.infinispan.protostream.FileDescriptorSource;
import org.infinispan.protostream.SerializationContext;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class RemoteQueryManagerTest
{
public static final String DEFAULT_CACHE_NAME = "remote-session-test";
@Test
public void test() throws Exception
{
SearchMapping mapping = new SearchMapping();
mapping.entity(SessionData.class).indexed().providedId().property("expiry", ElementType.FIELD).field();
@ -86,7 +82,6 @@ public class RemoteQueryManagerTest
baos = new ByteArrayOutputStream();
IO.copy(is, baos);
is.close();
}
String content = baos.toString("UTF-8");

View File

@ -25,7 +25,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
@ -35,7 +34,6 @@ import org.eclipse.jetty.util.resource.Resource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.eclipse.jetty.toolchain.test.matchers.RegexMatcher.matchesPattern;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
@ -43,6 +41,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.matchesRegex;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
@ -86,7 +85,7 @@ public class SslContextFactoryTest
for(String enabledCipher : cipherDump.enabled)
{
assertThat("Enabled Cipher Suite", enabledCipher, not(matchesPattern(".*_RSA_.*(SHA1|MD5|SHA)")));
assertThat("Enabled Cipher Suite", enabledCipher, not(matchesRegex(".*_RSA_.*(SHA1|MD5|SHA)")));
}
}

22
pom.xml
View File

@ -56,7 +56,7 @@
<!-- testing -->
<it.debug>false</it.debug>
<jetty.test.version>5.2</jetty.test.version>
<jetty.test.version>5.3</jetty.test.version>
<spring-boot.version>2.1.1.RELEASE</spring-boot.version>
<jsr250-api.version>1.0</jsr250-api.version>
<javax.annotation-api>1.3</javax.annotation-api>
@ -893,9 +893,8 @@
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@ -1055,21 +1054,6 @@
<artifactId>jnr-unixsocket</artifactId>
<version>0.22</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</dependencyManagement>

View File

@ -158,11 +158,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>

View File

@ -27,7 +27,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.servlet.AsyncContext;
import javax.servlet.ReadListener;
import javax.servlet.ServletException;
@ -58,10 +57,10 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
import static org.eclipse.jetty.http.client.Transport.FCGI;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;