Skip to content
Snippets Groups Projects
Commit ecb5e37e authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

OZG-4094 remove isStringBasedIdentifier from PostfachAddressidentifier

parent b527dc37
Branches
Tags
1 merge request!3Ozg 4094 update common version
...@@ -25,9 +25,5 @@ package de.ozgcloud.nachrichten.postfach; ...@@ -25,9 +25,5 @@ package de.ozgcloud.nachrichten.postfach;
public interface PostfachAddressIdentifier { public interface PostfachAddressIdentifier {
default boolean isStringBasedIdentifier() {
return false;
}
String getStringRepresentation(); String getStringRepresentation();
} }
...@@ -33,11 +33,6 @@ public class StringBasedIdentifier implements PostfachAddressIdentifier { ...@@ -33,11 +33,6 @@ public class StringBasedIdentifier implements PostfachAddressIdentifier {
@NotBlank @NotBlank
private String postfachId; private String postfachId;
@Override
public boolean isStringBasedIdentifier() {
return true;
}
@Override @Override
public String toString() { public String toString() {
return postfachId; return postfachId;
......
...@@ -70,12 +70,6 @@ public class InfoManagerService { ...@@ -70,12 +70,6 @@ public class InfoManagerService {
} }
String getPostfachId(@NonNull PostfachAddress address) { String getPostfachId(@NonNull PostfachAddress address) {
var postfachIdentifier = address.getIdentifier(); return address.getIdentifier().getStringRepresentation();
if (postfachIdentifier.isStringBasedIdentifier()) {
return postfachIdentifier.getStringRepresentation();
} else {
throw new IllegalStateException("Illegal Type of Postfach Identifier: " + postfachIdentifier.getClass().getName());
}
} }
} }
...@@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -28,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*; import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*; import static org.mockito.Mockito.*;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks; import org.mockito.InjectMocks;
...@@ -36,7 +35,6 @@ import org.mockito.Mock; ...@@ -36,7 +35,6 @@ import org.mockito.Mock;
import org.mockito.Spy; import org.mockito.Spy;
import de.ozgcloud.nachrichten.NachrichtenManagerProperties; import de.ozgcloud.nachrichten.NachrichtenManagerProperties;
import de.ozgcloud.nachrichten.postfach.PostfachAddressIdentifier;
import de.ozgcloud.nachrichten.postfach.PostfachAddressTestFactory; import de.ozgcloud.nachrichten.postfach.PostfachAddressTestFactory;
import de.ozgcloud.nachrichten.postfach.PostfachException; import de.ozgcloud.nachrichten.postfach.PostfachException;
import de.ozgcloud.nachrichten.postfach.PostfachMessageCode; import de.ozgcloud.nachrichten.postfach.PostfachMessageCode;
...@@ -139,19 +137,5 @@ class InfoManagerServiceTest { ...@@ -139,19 +137,5 @@ class InfoManagerServiceTest {
assertThat(id).isEqualTo(StringBasedIdentifierTestFactory.STRING_BASED_IDENTIFIER_POSTFACH_ID_VALUE); assertThat(id).isEqualTo(StringBasedIdentifierTestFactory.STRING_BASED_IDENTIFIER_POSTFACH_ID_VALUE);
} }
@Test
void shouldThrowExceptionForUnkownIdentifer() {
var identifier = new PostfachAddressIdentifier() {
@Override
public String getStringRepresentation() {
return StringUtils.EMPTY;
}
};
var address = PostfachAddressTestFactory.createBuilder().identifier(identifier).build();
assertThatThrownBy(() -> service.getPostfachId(address)).isInstanceOf(IllegalStateException.class);
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment