Skip to content
Snippets Groups Projects
Commit e91d9455 authored by OZG-Cloud Team's avatar OZG-Cloud Team
Browse files

OZG-4771 do renaming from code review

parent 57689c3e
No related branches found
No related tags found
No related merge requests found
......@@ -38,7 +38,7 @@ public class ServiceKonto {
private final String value;
public static boolean hasValue(String trustLevelValue) {
public static boolean exists(String trustLevelValue) {
if (StringUtils.isBlank(trustLevelValue)) {
return false;
}
......
......@@ -15,7 +15,7 @@ class TrustLevelTest {
@ParameterizedTest(name = "trust level is {0}")
@ValueSource(strings = {"STORK-QAA-Level-1", "STORK-QAA-Level-2", "STORK-QAA-Level-3", "STORK-QAA-Level-4"})
void shouldReturnTrue(String trustLevel) {
var isValid = TrustLevel.hasValue(trustLevel);
var isValid = TrustLevel.exists(trustLevel);
assertThat(isValid).isTrue();
}
......@@ -25,7 +25,7 @@ class TrustLevelTest {
@NullAndEmptySource
@ValueSource(strings = {"STORK-QAA-Level-0", "unexpected"})
void shouldReturnFalse(String trustLevel) {
var isValid = TrustLevel.hasValue(trustLevel);
var isValid = TrustLevel.exists(trustLevel);
assertThat(isValid).isFalse();
}
......
......@@ -103,7 +103,7 @@ public class ServiceKontoFactory {
}
boolean isValidTrustLevel(Map<String, Object> formDataHeader) {
return TrustLevel.hasValue(getTrustLevel(formDataHeader));
return TrustLevel.exists(getTrustLevel(formDataHeader));
}
ServiceKonto buildBayernIdServiceKonto(Map<String, Object> formDataHeaders) {
......@@ -114,10 +114,6 @@ public class ServiceKontoFactory {
.build();
}
String getTrustLevel(Map<String, Object> formDataHeaders) {
return MapUtils.getString(formDataHeaders, KEY_BAYERN_ID_TRUST_LEVEL);
}
PostfachAddress buildPostfachAddress(String postkorbHandle) {
return PostfachAddress.builder()
.type(POSTFACH_ADDRESS_DEFAULT)
......@@ -130,4 +126,8 @@ public class ServiceKontoFactory {
return StringBasedIdentifier.builder().postfachId(postfachId).build();
}
String getTrustLevel(Map<String, Object> formDataHeaders) {
return MapUtils.getString(formDataHeaders, KEY_BAYERN_ID_TRUST_LEVEL);
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ public class DFoerdermittelEngineBasedSemantikAdapter implements EngineBasedSema
private static final String KEY_ORGANISATIONS_EINHEIT_ID = "MetaText1";
@Autowired
private ServiceKontoFactory serviceKontoHelper;
private ServiceKontoFactory serviceKontoFactory;
@Override
public FormData parseFormData(FormData formData) {
......@@ -109,7 +109,7 @@ public class DFoerdermittelEngineBasedSemantikAdapter implements EngineBasedSema
}
private ServiceKonto createServiceKonto(String postfachId) {
return serviceKontoHelper.buildOsiServiceKonto(postfachId);
return serviceKontoFactory.buildOsiServiceKonto(postfachId);
}
FormData parseFachnachricht(FormData formData, IncomingFile fachnachrichtFile) {
......
......@@ -208,18 +208,18 @@ class ServiceKontoFactoryTest {
class TestIsValidTrustLevel {
@Test
void shouldCallHasValue() {
void shouldCallExists() {
try (var trustLevelMock = mockStatic(TrustLevel.class)) {
isValidTrustLevel();
trustLevelMock.verify(() -> TrustLevel.hasValue(ServiceKontoTestFactory.TRUST_LEVEL));
trustLevelMock.verify(() -> TrustLevel.exists(ServiceKontoTestFactory.TRUST_LEVEL));
}
}
@Test
void shouldReturnValue() {
try (var trustLevelMock = mockStatic(TrustLevel.class)) {
trustLevelMock.when(() -> TrustLevel.hasValue(any())).thenReturn(true);
trustLevelMock.when(() -> TrustLevel.exists(any())).thenReturn(true);
var result = isValidTrustLevel();
......@@ -280,7 +280,7 @@ class ServiceKontoFactoryTest {
assertThat(serviceKonto.getTrustLevel()).isEqualTo(TRUST_LEVEL);
}
ServiceKonto buildBayernIdServiceKonto() {
private ServiceKonto buildBayernIdServiceKonto() {
return factory.buildBayernIdServiceKonto(formDataHeaders);
}
}
......
......@@ -33,7 +33,7 @@ class DFoerdermittelEngineBasedSemantikAdapterTest {
private DFoerdermittelEngineBasedSemantikAdapter adapter;
@Mock
private ServiceKontoFactory serviceKontoHelper;
private ServiceKontoFactory serviceKontoFactory;
@Nested
class TestIsResponsible {
......@@ -174,7 +174,7 @@ class DFoerdermittelEngineBasedSemantikAdapterTest {
@BeforeEach
void init() {
when(serviceKontoHelper.buildOsiServiceKonto(any())).thenReturn(ServiceKontoTestFactory.create());
when(serviceKontoFactory.buildOsiServiceKonto(any())).thenReturn(ServiceKontoTestFactory.create());
}
@Test
......@@ -191,7 +191,7 @@ class DFoerdermittelEngineBasedSemantikAdapterTest {
void shouldRemovePrefix() {
adapter.addServiceKonto(DFoerdermittelFormDataTestFactory.create(), DFoerdermittelFormDataTestFactory.createFachnachrichtMap());
verify(serviceKontoHelper).buildOsiServiceKonto(DFoerdermittelFormDataTestFactory.POSTFACH_ID);
verify(serviceKontoFactory).buildOsiServiceKonto(DFoerdermittelFormDataTestFactory.POSTFACH_ID);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment