Questions tagged [jersey-test-framework]

113 questions
9
votes
1 answer

JerseyTest using GrizzlyWebTestContainerFactory in Jersey 2.13

I am trying to get a JerseyTest running using a org.glassfish.jersey.test.grizzly.GrizzlyWebContainerFactory. I already searched the internet and tried several things for the better part of a day. It seems to be impossible and I would really…
ali
  • 1,374
  • 4
  • 20
  • 34
8
votes
1 answer

MessageBodyWriter not found for media type=multipart/form-data in JerseyTest

I'm trying to create a test for a POST method in a resource class in a Jersey program. Here's the POST method of the resource: @POST @Path("/new") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response HTTPPostMethod(@FormDataParam("file")…
7
votes
3 answers

Static initializer doesn't run during JUnit tests

I have an interesting JUnit problem here (JUnit 4.12). I have a base class that only has static methods. They have to be static, because of the way they're used. I inherit other classes from the base class. So, if the base class is Base, we have…
Frecklefoot
  • 1,554
  • 1
  • 15
  • 43
7
votes
3 answers

How do I get Jersey Test/Client to not fill in a default Accept header?

I'm trying to handle a request with no Accept header in a particular way, but Jersey seems hell-bent on filling one in, no matter what I do, so it always looks like the request has an Accept header, even if it doesn't. import…
postfuturist
  • 20,913
  • 11
  • 57
  • 84
7
votes
2 answers

How to start a Jersey Test Container (Grizzly) once for all tests in a test class?

I am working on fixing the integration tests in one of the projects. Currently, all the integration test classes extend the JerseyTest class. Going through the JerseyTest class I realized that it starts and stops the container for every test method…
Karthick R
  • 559
  • 8
  • 24
6
votes
1 answer

Mock Service inside resource using jersey test framwork

I have a resource for rest API which uses a service. This service has a constructor with parameters. I want to test this resource and to mock this service. This Question: How to pass parameters to REST resource using Jersey 2.5 wasn't helpful…
4
votes
1 answer

Jackson LocalDate/Time deserialization

I configured jackson so that it gives me a smiple string representation if java.time.LocalDate and java.time.LocalDateTime. This works find in the serialization process, e.g when I get data on the REST api. It doesn't work the other way round…
Mrvonwyl
  • 317
  • 2
  • 12
4
votes
1 answer

Jersey test - ExceptionMapper is not invoked

I have REST web service which I test with Jersey Test, Mockito, Junit. When web service method is executed successfully, I get correct response. In case of invalid data, custom exception is thrown which must be handled by ExceptionMapper. It should…
4
votes
1 answer

Jersey client API vs Jersey test framework

I am new to web services and would like to know what is the difference between Jersey client API and jersey test framework? I would like to test my jersey REST web-services end points. Which is the the right one to use?
user1247412
  • 629
  • 5
  • 15
  • 28
3
votes
0 answers

Unable to see logs in Jersey Test Framework Enabled via TestProperties class

I'm trying to run tests using maven for Jersey Test Framework, In this code basically I'm trying to test a resource, I also wanted to dump the entity to the console and also look at the log traffic for the kind of request I'm getting ... Here is the…
an0nh4x0r
  • 364
  • 4
  • 18
3
votes
1 answer

ExceptionMapper not working in JerseyTest framework

I had made an RESTFUL-API for an specific object and using javax.validation.Constraints for validation, when I execute the app it works as expected and ExceptionMapper class is been executed correctly but when I try to automatize tests with…
Carlos Zerga
  • 160
  • 2
  • 8
3
votes
1 answer

Jersey Unit Test: in memory container vs grizzly

I'm trying to get my head around unit testing in Jersey. The classes that do not depend on Jersey directly can be unit tested using standard JUnit. This one is OK. But there are also Jersey (or, should I say JAX-RS?) dependent classes. In order to…
Vasiliy
  • 14,686
  • 5
  • 56
  • 105
3
votes
4 answers

JerseyTest Default port change to test REST WEB SERVICE

I made a test case to test my Rest Web Service. but in test case I am seeing that the request is going to default port of jersey test framework which is http://localhost:9998 whereas my service is register on http://localhost:8080. I am unable to…
Despicable
  • 3,227
  • 3
  • 21
  • 40
3
votes
2 answers

How to use @BeforeClass and @AfterClass within a JerseyTest suite

It turns out that JUnit wants @BeforeClass and @AfterClass to be static and this doesn't get along well with JerseyTest's configure method override. Is there a known way to configure the Jersey application while still being able to access JUnit's…
Ivo
  • 5,937
  • 1
  • 23
  • 42
3
votes
0 answers

Can I test websockets with Jersey Test Framework?

I have a Restful web service that I want to test. For this I use the Jersey Test Framework. In addition to the JAX-RS resources are also used websockets, which should also be tested. But when I tried to test websocket endpoint using Tyrus client I…
Alexiuscrow
  • 717
  • 13
  • 29
1
2 3 4 5 6 7 8