Migrating away from hamcrest deprecated matchers
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
702e32049e
commit
112d08259d
|
@ -29,7 +29,6 @@ import java.security.KeyStore;
|
|||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLException;
|
||||
|
@ -61,8 +60,8 @@ import org.junit.jupiter.api.condition.DisabledOnOs;
|
|||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.isEmptyOrNullString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.condition.OS.WINDOWS;
|
||||
|
@ -270,19 +269,19 @@ public class SelectChannelServerSslTest extends HttpServerTestBase
|
|||
|
||||
Matcher matcher=Pattern.compile("cipher_suite='([^']*)'").matcher(response);
|
||||
matcher.find();
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(isEmptyOrNullString()),not(is("null"))));
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(is(emptyOrNullString()))),not(is("null")));
|
||||
|
||||
matcher=Pattern.compile("key_size='([^']*)'").matcher(response);
|
||||
matcher.find();
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(isEmptyOrNullString()),not(is("null"))));
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(is(emptyOrNullString())),not(is("null"))));
|
||||
|
||||
matcher=Pattern.compile("ssl_session_id='([^']*)'").matcher(response);
|
||||
matcher.find();
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(isEmptyOrNullString()),not(is("null"))));
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(is(emptyOrNullString())),not(is("null"))));
|
||||
|
||||
matcher=Pattern.compile("ssl_session='([^']*)'").matcher(response);
|
||||
matcher.find();
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(isEmptyOrNullString()),not(is("null"))));
|
||||
assertThat(matcher.group(1), Matchers.allOf(not(is(emptyOrNullString())),not(is("null"))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,21 +18,10 @@
|
|||
|
||||
package org.eclipse.jetty.server.handler.gzip;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.isEmptyOrNullString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
@ -50,6 +39,16 @@ import org.eclipse.jetty.util.StringUtil;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
/**
|
||||
* Test the GzipHandler support built into the {@link DefaultServlet}
|
||||
*/
|
||||
|
@ -502,7 +501,7 @@ public class GzipDefaultTest
|
|||
{
|
||||
tester.start();
|
||||
HttpTester.Response response = assertIsResponseNotGzipCompressed(tester,"GET","file.mp3.deferred",filesize,HttpStatus.OK_200);
|
||||
assertThat("Response[Vary]", response.get("Vary"), isEmptyOrNullString());
|
||||
assertThat("Response[Vary]", response.get("Vary"), is(emptyOrNullString()));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -18,16 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.server.handler.gzip;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.isEmptyOrNullString;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
@ -46,7 +36,6 @@ import java.util.regex.Pattern;
|
|||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import javax.servlet.DispatcherType;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -67,6 +56,16 @@ import org.eclipse.jetty.util.log.Log;
|
|||
import org.eclipse.jetty.util.log.Logger;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
|
||||
public class GzipTester
|
||||
{
|
||||
|
@ -147,7 +146,7 @@ public class GzipTester
|
|||
}
|
||||
else
|
||||
{
|
||||
assertThat("Unexpected response content-encoding", contentEncoding, isEmptyOrNullString());
|
||||
assertThat("Unexpected response content-encoding", contentEncoding, is(emptyOrNullString()));
|
||||
}
|
||||
|
||||
uncompressedStream = new ByteArrayOutputStream((int)size);
|
||||
|
|
Loading…
Reference in New Issue