Skip to content

Commit

Permalink
Some jetty-servlet test cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
  • Loading branch information
joakime committed Jul 16, 2020
1 parent beca81c commit 8e7bfa0
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@

package org.eclipse.jetty.servlet;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import org.eclipse.jetty.util.log.StacklessLogging;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Assertions.assertThrows;

/**
* FilterHolderTest
Expand All @@ -49,13 +47,13 @@ public void testInitialize()
Filter filter = new Filter()
{
@Override
public void init(FilterConfig filterConfig) throws ServletException
public void init(FilterConfig filterConfig)
{
counter.incrementAndGet();
}

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
{
}

Expand All @@ -71,14 +69,9 @@ public void destroy()
fh.setName("xx");
fh.setFilter(filter);

try (StacklessLogging stackless = new StacklessLogging(FilterHolder.class))
try (StacklessLogging ignored = new StacklessLogging(FilterHolder.class))
{
fh.initialize();
fail("Not started");
}
catch (Exception e)
{
//expected
assertThrows(IllegalStateException.class, fh::initialize);
}

fh.start();
Expand Down
Loading

0 comments on commit 8e7bfa0

Please sign in to comment.