eclipse-ee4j / eclipse-ee4j/jersey

JerseyTest: ServletDeploymentContext.addFilter() has no effect

Open
#3,368 5 comments 0 reactions 0 assignees View on GitHub
Component: test-framework Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

I have the following test class:

```
**MyTest.java**public class MyTest extends JerseyTest {
@Override
protected DeploymentContext configureDeployment() {
return ServletDeploymentContext.builder(configure()).addFilter(SomeFilter.class, "SomeFilterName").build();
}
}
```

Plus the following filter

```
**SomeFilter.java**public class SomeFilter implements Filter {
public void init(FilterConfig filterConfig) {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
filterChain.doFilter(servletRequest, servletResponse);
}
public void destroy() {
}
}
```

If been looking through the code and couldn't find any place where the fitler I added would be read. I would have expected it to be read in GrizzlyTestContainerFactory#GrizzlyTestContainer, JettyTestContainerFactory#JettyTestContainer or InMemoryTestContainerFactory#InMemoryTestContainer.

Looks like this feature was not used so far and is not implemented yet.
#### Affected Versions
[2.22.1]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.