Why are my tests not triggering my filter?

Why are my tests not triggering my filter?

I have following Problem. My tests are running allways positive even when the HttpHeaders.AUTHORIZATION headder has a wrong token. In theory it should fail because I have a filter that checks the token. My Jax-RS program is working perfectly in the browser or using a httpclient like postman. So I have to generate a token first and then use that token to run the HTTP commands otherwise it will return the statuscode 401. I think that my configuration is wrong and the Testframework is running the tests without triggering the filter. I never worked with Jax-RS before and I have no Idea how to fix that...

I have following Problem. My tests are running allways positive even when the HttpHeaders.AUTHORIZATION headder has a wrong token. In theory it should fail because I have a filter that checks the token. My Jax-RS program is working perfectly in the browser or using a httpclient like postman. So I have to generate a token first and then use that token to run the HTTP commands otherwise it will return the statuscode 401. I think that my configuration is wrong and the Testframework is running the tests without triggering the filter. I never worked with Jax-RS before and I have no Idea how to fix that...

public class GamesTest extends JerseyTest{


@Override protected Application configure() { return new ResourceConfig(Games.class).register(new AbstractBinder() { protected void configure() { bind(GamesXMLDB.class).to(MyGameDBInterfaceDB.class).in(Singleton.class); bind(UserXMLDB.class).to(MyUserInterfaceDB.class).in(Singleton.class); } }); }

@Test public void getWithoutTokenTest() { Response response = target("/games").request().header(HttpHeaders.AUTHORIZATION, "").get(); assertEquals(200, response.getStatus()); }


java

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Java Core (2020) | Java for beginners | Brush up your Java Skills | Get Hired

In this video we will learn about all the major concepts that come under Java Core . The course is very carefully designed and is made with keeping simplicit...

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!

Top 10 Java Frameworks For Web App Development: 2020 Edition

Java Frameworks are the pre-written code body through which you are enabled to add your own code. There are numerous Java frameworks that have different leading features, on the basis of the same here, I will discuss Top 10 JAVA Frameworks For Web App Development 2020-2021. 

How Java Became The Best Career Option for IT Jobs in 2020?

Join CETPA, India's best institute for Java online training and Certification Course. Enroll now to learn Core to Advanced Java & avail 50% discount on Java Online Course with Certificate.