Skip to content
Snippets Groups Projects
Commit e69428ee authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'adjust not foun exception message' (#37) from...

Merge pull request 'adjust not foun exception message' (#37) from AdjustNotFoundExceptionMessage into master

Reviewed-on: https://git.ozg-sh.de/ozgcloud-lib/api-lib/pulls/37


Reviewed-by: default avatarOZGCloud <ozgcloud@mgm-tp.com>
parents 58b72680 931d8f55
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,6 @@ public class NotFoundException extends RuntimeException { ...@@ -7,6 +7,6 @@ public class NotFoundException extends RuntimeException {
private static final String MESSAGE_TEMPL = "%s with id '%s' not found."; private static final String MESSAGE_TEMPL = "%s with id '%s' not found.";
public NotFoundException(StringBasedValue id, String entityName) { public NotFoundException(StringBasedValue id, String entityName) {
super(MESSAGE_TEMPL.formatted(id.toString(), entityName)); super(MESSAGE_TEMPL.formatted(entityName, id.toString()));
} }
} }
package de.ozgcloud.apilib.common.errorhandling;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import de.ozgcloud.apilib.common.datatypes.GenericId;
class NotFoundExceptionTest {
private final GenericId id = GenericId.from("dummyId");
private final String entityName = "DummyEntity";
@Test
void shouldHaveMessage() {
var exception = new NotFoundException(id, entityName);
assertThat(exception.getMessage()).isEqualTo(entityName + " with id '" + id + "' not found.");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment