Exemplo n.º 1
0
  @Test
  public void when_endpoint_contains_two_variables_replace_them_all() throws Exception {
    // GIVEN
    ConfigLoader.loadMappingsConfig(false);

    // WHEN
    MappingEndpoint endpoint =
        ConfigLoader.getConfig().get(0).getMappingEndpoint("/v0.1/contacts/mobile/support", "GET");

    // THEN
    assertEquals(endpoint.getInternalEndpoint(), "/contacts/mobile/support");
  }
Exemplo n.º 2
0
  @Test
  public void when_endpoint_contains_RE_return_it_from_RE_mappings() throws Exception {
    // GIVEN
    ConfigLoader.loadMappingsConfig(false);

    // WHEN
    MappingEndpoint endpoint =
        ConfigLoader.getConfig().get(0).getMappingEndpoint("/v0.1/payments/12345", "GET");

    // THEN
    assertEquals(endpoint.getInternalEndpoint(), "/payments/12345");
  }
Exemplo n.º 3
0
  @Test
  public void when_load_read_mapping() throws Exception {

    // WHEN
    ConfigLoader.loadMappingsConfig(false);

    // THEN
    List<MappingConfig> config = ConfigLoader.getConfig();
    Map<String, String> actions = config.get(0).getActions();
    assertEquals(actions.get("ReplaceCustomerId"), "com.apifest.example.ReplaceCustomerIdAction");
    assertEquals(actions.get("AddSenderIdInBody"), "com.apifest.example.AddSenderIdInBody");

    MappingEndpoint endpoint = config.get(0).getMappingEndpoint("/v0.1/me", "GET");
    assertEquals(endpoint.getInternalEndpoint(), "/customer/{customerId}");
    assertEquals(endpoint.getAction().getName(), "ReplaceCustomerId");
  }