Hey,
I need to create a JerseyClient in my unit test of a resource. JerseyClient 
requires the "Environment" to be passed as a parameter.

Currently I am using the DropwizardAppRule which starts the application, 
and also exposes the Environment and Configuration. However, I do not want 
to start the application, I just need the client. Is that possible?

I have:
 @ClassRule
 public static final DropwizardAppRule<TestConfiguration> RULE = new 
DropwizardAppRule<TestConfiguration>(
 TestApp.class, ResourceHelpers.resourceFilePath("cfg/app.yml"));


 @Test
 public void calcTest() {
 HttpHeaders headers = Mockito.mock(HttpHeaders.class);
 Mockito.when(headers.getHeaderString(HttpHeaders.AUTHORIZATION)).thenReturn
("Bearer ");
 
 Client client = new JerseyClientBuilder(RULE.getEnvironment()).build("test 
client");
 TestRS RS = new TestRS(client, RULE.getConfiguration().getTestUrl());
 Response response = RS.getPV(headers, "ABC", "2016-01-01", "121");
 Assert.assertEquals(response.getStatus(), 200);
 }

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to