Search in sources :

Example 1 with RequestPatternBuilder

use of com.github.tomakehurst.wiremock.client.RequestPatternBuilder in project opennms by OpenNMS.

the class MeasurementApiConnectorIT method testAuthentication.

@Test
public void testAuthentication() throws IOException {
    Result result = new MeasurementApiClient().execute(false, "http://localhost:9999/opennms/rest/measurements", "admin", "admin", "<dummy request>");
    Assert.assertTrue(result.wasSuccessful());
    Assert.assertFalse(result.wasRedirection());
    Assert.assertEquals(200, result.getResponseCode());
    Assert.assertNotNull(result.getInputStream());
    Assert.assertNull(result.getErrorStream());
    RequestPatternBuilder requestPatternBuilder = createDefaultRequestPatternBuilder("/opennms/rest/measurements");
    requestPatternBuilder.withHeader("Authorization", WireMock.matching("Basic .*"));
    verifyWiremock(requestPatternBuilder);
}
Also used : RequestPatternBuilder(com.github.tomakehurst.wiremock.client.RequestPatternBuilder) Test(org.junit.Test)

Aggregations

RequestPatternBuilder (com.github.tomakehurst.wiremock.client.RequestPatternBuilder)1 Test (org.junit.Test)1