test_class.declarator: KNOWN_ENTITY_ID = DefaultEntityId.of("Plumbus")
test_class.modifier: private static final
test_class.original_string: private static final EntityId KNOWN_ENTITY_ID = DefaultEntityId.of("Plumbus");
test_class.type: EntityId
test_class.var_name: KNOWN_ENTITY_ID
test_class.declarator: KNOWN_RESOURCE_PATH = "Floob"
test_class.modifier: private static final
test_class.original_string: private static final String KNOWN_RESOURCE_PATH = "Floob";
test_class.type: String
test_class.var_name: KNOWN_RESOURCE_PATH
test_class.file: services/gateway/endpoints/src/test/java/org/eclipse/ditto/services/gateway/endpoints/actors/UriForLocationHeaderSupplierTest.java
test_class.identifier: UriForLocationHeaderSupplierTest
test_case.body: @Test
      public void getUriForNonIdempotentRequestWithEntityIdInUri() {
          final String host = "https://example.com/things/";
          final Uri uri = Uri.create(host + KNOWN_ENTITY_ID + "will-be-discarded/");
          final HttpRequest httpRequest = HttpRequest.create()
                  .withUri(uri)
                  .withMethod(HttpMethods.POST);
          final CommandResponse<?> commandResponse = mock(CommandResponse.class);
          when(commandResponse.getEntityId()).thenReturn(KNOWN_ENTITY_ID);
          when(commandResponse.getResourcePath()).thenReturn(JsonPointer.of(KNOWN_RESOURCE_PATH));
          final Uri expectedUri = Uri.create(host + commandResponse.getEntityId() + commandResponse.getResourcePath());
  
          final UriForLocationHeaderSupplier underTest = new UriForLocationHeaderSupplier(httpRequest, commandResponse);
  
          assertThat(underTest.get()).isEqualTo(expectedUri);
      }
test_case.class_method_signature: UriForLocationHeaderSupplierTest.getUriForNonIdempotentRequestWithEntityIdInUri()
test_case.full_signature: @Test public void getUriForNonIdempotentRequestWithEntityIdInUri()
test_case.identifier: getUriForNonIdempotentRequestWithEntityIdInUri
test_case.invocations: create withMethod withUri create mock thenReturn when getEntityId thenReturn when getResourcePath of create getEntityId getResourcePath isEqualTo assertThat get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getUriForNonIdempotentRequestWithEntityIdInUri()
focal_class.declarator: httpRequest
focal_class.modifier: private final
focal_class.original_string: private final HttpRequest httpRequest;
focal_class.type: HttpRequest
focal_class.var_name: httpRequest
focal_class.declarator: commandResponse
focal_class.modifier: private final
focal_class.original_string: private final CommandResponse<?> commandResponse;
focal_class.type: CommandResponse<?>
focal_class.var_name: commandResponse
focal_class.file: services/gateway/endpoints/src/main/java/org/eclipse/ditto/services/gateway/endpoints/actors/UriForLocationHeaderSupplier.java
focal_class.identifier: UriForLocationHeaderSupplier
focal_class.interfaces: implements Supplier<Uri>
focal_class.class_method_signature: UriForLocationHeaderSupplier.UriForLocationHeaderSupplier(final HttpRequest httpRequest, final CommandResponse<?> commandResponse)
focal_class.full_signature:   UriForLocationHeaderSupplier(final HttpRequest httpRequest, final CommandResponse<?> commandResponse)
focal_class.identifier: UriForLocationHeaderSupplier
focal_class.parameters: (final HttpRequest httpRequest, final CommandResponse<?> commandResponse)
focal_class.signature:  UriForLocationHeaderSupplier(final HttpRequest httpRequest, final CommandResponse<?> commandResponse)
focal_class.class_method_signature: UriForLocationHeaderSupplier.get()
focal_class.full_signature: @Override public Uri get()
focal_class.identifier: get
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Uri
focal_class.signature: Uri get()
focal_class.class_method_signature: UriForLocationHeaderSupplier.isRequestIdempotent()
focal_class.full_signature: private boolean isRequestIdempotent()
focal_class.identifier: isRequestIdempotent
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isRequestIdempotent()
focal_class.class_method_signature: UriForLocationHeaderSupplier.removeEntityId(final String requestUri)
focal_class.full_signature: private String removeEntityId(final String requestUri)
focal_class.identifier: removeEntityId
focal_class.modifiers: private
focal_class.parameters: (final String requestUri)
focal_class.return: String
focal_class.signature: String removeEntityId(final String requestUri)
focal_class.class_method_signature: UriForLocationHeaderSupplier.getIndexOfEntityId(final String requestUri)
focal_class.full_signature: private int getIndexOfEntityId(final String requestUri)
focal_class.identifier: getIndexOfEntityId
focal_class.modifiers: private
focal_class.parameters: (final String requestUri)
focal_class.return: int
focal_class.signature: int getIndexOfEntityId(final String requestUri)
focal_class.class_method_signature: UriForLocationHeaderSupplier.removeTrailingSlash(final String createdLocationUri)
focal_class.full_signature: private static String removeTrailingSlash(final String createdLocationUri)
focal_class.identifier: removeTrailingSlash
focal_class.modifiers: private static
focal_class.parameters: (final String createdLocationUri)
focal_class.return: String
focal_class.signature: String removeTrailingSlash(final String createdLocationUri)
focal_class.class_method_signature: UriForLocationHeaderSupplier.getLocationUriString(final String requestUri)
focal_class.full_signature: private String getLocationUriString(final String requestUri)
focal_class.identifier: getLocationUriString
focal_class.modifiers: private
focal_class.parameters: (final String requestUri)
focal_class.return: String
focal_class.signature: String getLocationUriString(final String requestUri)
focal_method.body: @Override
      public Uri get() {
          final Uri requestUri = httpRequest.getUri().query(Query.EMPTY); // strip query params
          if (isRequestIdempotent()) {
              return requestUri.query(Query.EMPTY);
          }
          return Uri.create(removeTrailingSlash(getLocationUriString(removeEntityId(requestUri.toString()))))
                  .query(Query.EMPTY);
      }
focal_method.class_method_signature: UriForLocationHeaderSupplier.get()
focal_method.full_signature: @Override public Uri get()
focal_method.identifier: get
focal_method.invocations: query getUri isRequestIdempotent query query create removeTrailingSlash getLocationUriString removeEntityId toString
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Uri
focal_method.signature: Uri get()