get rid of remaining legacy junit (#2900)

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
Olivier Lamy 2018-09-13 07:11:09 +10:00 committed by GitHub
parent 4b461b7556
commit 98cc338d2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 20 deletions

View File

@ -22,9 +22,9 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.junit.AfterClass; import org.junit.jupiter.api.AfterAll;
import org.junit.BeforeClass; import org.junit.jupiter.api.BeforeAll;
import org.junit.Test; import org.junit.jupiter.api.Test;
import javax.jws.WebMethod; import javax.jws.WebMethod;
import javax.jws.WebService; import javax.jws.WebService;
@ -35,13 +35,13 @@ public class TestEndpointMultiplePublishProblem
private static String default_impl = System.getProperty("com.sun.net.httpserver.HttpServerProvider"); private static String default_impl = System.getProperty("com.sun.net.httpserver.HttpServerProvider");
@BeforeClass @BeforeAll
public static void change_Impl() public static void change_Impl()
{ {
System.setProperty("com.sun.net.httpserver.HttpServerProvider", JettyHttpServerProvider.class.getName()); System.setProperty("com.sun.net.httpserver.HttpServerProvider", JettyHttpServerProvider.class.getName());
} }
@AfterClass @AfterAll
public static void restore_Impl() public static void restore_Impl()
{ {
if(default_impl != null) if(default_impl != null)

View File

@ -18,29 +18,27 @@
package org.eclipse.jetty.util.thread; package org.eclipse.jetty.util.thread;
import static org.hamcrest.MatcherAssert.assertThat;
import org.eclipse.jetty.util.ProcessorUtils; import org.eclipse.jetty.util.ProcessorUtils;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool; import org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.AfterClass; import org.junit.jupiter.api.AfterAll;
import org.junit.Assert; import org.junit.jupiter.api.BeforeAll;
import org.junit.BeforeClass; import org.junit.jupiter.api.Test;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.fail;
public abstract class AbstractThreadPoolTest public abstract class AbstractThreadPoolTest
{ {
private static int originalCoreCount; private static int originalCoreCount;
@BeforeClass @BeforeAll
public static void saveState() public static void saveState()
{ {
originalCoreCount = ProcessorUtils.availableProcessors(); originalCoreCount = ProcessorUtils.availableProcessors();
} }
@AfterClass @AfterAll
public static void restoreState() public static void restoreState()
{ {
ProcessorUtils.setAvailableProcessors(originalCoreCount); ProcessorUtils.setAvailableProcessors(originalCoreCount);
@ -58,11 +56,11 @@ public abstract class AbstractThreadPoolTest
try try
{ {
pool.getThreadPoolBudget().leaseTo(this,3); pool.getThreadPoolBudget().leaseTo(this,3);
Assert.fail(); fail();
} }
catch(IllegalStateException e) catch(IllegalStateException e)
{ {
Assert.assertThat(e.getMessage(),Matchers.containsString("Insufficient configured threads")); assertThat(e.getMessage(),Matchers.containsString("Insufficient configured threads"));
} }
pool.getThreadPoolBudget().leaseTo(this,1); pool.getThreadPoolBudget().leaseTo(this,1);
@ -80,14 +78,14 @@ public abstract class AbstractThreadPoolTest
try try
{ {
pool.setMaxThreads(1); pool.setMaxThreads(1);
Assert.fail(); fail();
} }
catch(IllegalStateException e) catch(IllegalStateException e)
{ {
Assert.assertThat(e.getMessage(),Matchers.containsString("Insufficient configured threads")); assertThat(e.getMessage(),Matchers.containsString("Insufficient configured threads"));
} }
Assert.assertThat(pool.getMaxThreads(),Matchers.is(3)); assertThat(pool.getMaxThreads(),Matchers.is(3));
} }