io.dropwizard.testing.FixtureHelpers Java Examples
The following examples show how to use
io.dropwizard.testing.FixtureHelpers.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComplianceToolModeTest.java From verify-service-provider with MIT License | 5 votes |
@Test public void testThatThereAreDefaults() throws Exception { ComplianceToolMode complianceToolMode = new ComplianceToolMode(objectMapper, Validators.newValidator(), mock(VerifyServiceProviderApplication.class)); final Subparser subparser = createParser(); complianceToolMode.configure(subparser); Namespace namespace = subparser.parseArgs(noArguments()); MatchingDataset actual = namespace.get(ComplianceToolMode.IDENTITY_DATASET); String expectedMatchingDataset = FixtureHelpers.fixture("default-test-identity-dataset.json"); String receivedMatchingDataset = objectMapper.writeValueAsString(actual); assertThat(new JSONObject(receivedMatchingDataset)) .isEqualToComparingFieldByFieldRecursively(new JSONObject(expectedMatchingDataset)); String url = namespace.get(ComplianceToolMode.ASSERTION_CONSUMER_URL); assertThat(url).isEqualTo(ComplianceToolMode.DEFAULT_CONSUMER_URL); Integer timeout = namespace.get(ComplianceToolMode.TIMEOUT); assertThat(timeout).isEqualTo(ComplianceToolMode.DEFAULT_TIMEOUT); Integer port = namespace.get(ComplianceToolMode.PORT); assertThat(port).isEqualTo(ComplianceToolMode.DEFAULT_PORT); String host = namespace.get(ComplianceToolMode.BIND_HOST); assertThat(host).isEqualTo(ComplianceToolMode.DEFAULT_HOST); }
Example #2
Source File: MarathonInstanceDiscoveryTest.java From breakerbox with Apache License 2.0 | 5 votes |
@Test public void testCreateServiceInstanceList() throws Exception { List<Instance> instanceList = marathonInstanceDiscovery.createServiceInstanceList(FixtureHelpers.fixture("fixtures/marathonClientResponse.json"),marathonClientConfiguration); Assert.assertEquals(Arrays.asList( new Instance("xyz.net:28083", "production", true)), instanceList); }
Example #3
Source File: RancherInstanceDiscoveryTest.java From breakerbox with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { when(rancherClient.getServiceInstanceDetails()).thenReturn(response); when(response.getStatus()).thenReturn(Response.Status.OK.getStatusCode()); when(response.readEntity(String.class)) .thenReturn(FixtureHelpers.fixture("fixtures/rancherClientResponse.json")); rancherInstanceDiscovery = new RancherInstanceDiscovery(rancherClient, MAPPER); }
Example #4
Source File: JsonHelpers.java From monasca-common with Apache License 2.0 | 2 votes |
/** * Loads the given fixture resource as a normalized JSON string. * * @param filename the filename of the fixture * @return the contents of {@code filename} as a normalized JSON string * @throws IOException if there is an error parsing {@code filename} */ public static String jsonFixture(String filename) throws IOException { return MAPPER.writeValueAsString(MAPPER.readValue(FixtureHelpers.fixture(filename), JsonNode.class)); }