mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-03 01:32:55 +00:00
Testcode aufgeräumt
This commit is contained in:
@ -5,7 +5,7 @@ import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class AtcCodeTest {
|
||||
class AtcCodeTest {
|
||||
|
||||
@Test
|
||||
void testShouldDetectAtcCodeScheme() {
|
||||
|
@ -128,7 +128,7 @@ class DNPMHelperTest {
|
||||
@Test
|
||||
void testShouldReturnEmptyStringOnParamCheckIfNoDataFormParamGiven() {
|
||||
var actual = dnpmHelper.getProzedurenFromDiagnose(Map.of("DiagnoseId", 1, "PatientId", 2));
|
||||
assertThat(actual).isEqualTo("");
|
||||
assertThat(actual).isExactlyInstanceOf(String.class).isEmpty();
|
||||
|
||||
verify(onkostarApi, times(0)).getProceduresByPatientId(anyInt());
|
||||
}
|
||||
@ -136,7 +136,7 @@ class DNPMHelperTest {
|
||||
@Test
|
||||
void testShouldReturnEmptyStringOnParamCheckIfNoDiagnoseIdParamGiven() {
|
||||
var actual = dnpmHelper.getProzedurenFromDiagnose(Map.of("dataForm", "OS.Example", "PatientId", 2));
|
||||
assertThat(actual).isEqualTo("");
|
||||
assertThat(actual).isExactlyInstanceOf(String.class).isEmpty();
|
||||
|
||||
verify(onkostarApi, times(0)).getProceduresByPatientId(anyInt());
|
||||
}
|
||||
@ -144,7 +144,7 @@ class DNPMHelperTest {
|
||||
@Test
|
||||
void testShouldReturnEmptyStringOnParamCheckIfNoPatientIdParamGiven() {
|
||||
var actual = dnpmHelper.getProzedurenFromDiagnose(Map.of("dataForm", "OS.Example", "DiagnoseId", 1));
|
||||
assertThat(actual).isEqualTo("");
|
||||
assertThat(actual).isExactlyInstanceOf(String.class).isEmpty();
|
||||
|
||||
verify(onkostarApi, times(0)).getProceduresByPatientId(anyInt());
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import java.util.Set;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class AnalyzerUtilsTest {
|
||||
class AnalyzerUtilsTest {
|
||||
|
||||
private final Map<String, Object> input = Map.of("value1", 1, "valueA", "A", "valueTrue", true);
|
||||
|
||||
|
@ -15,7 +15,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class FollowUpAnalyzerTest {
|
||||
class FollowUpAnalyzerTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
|
@ -20,7 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TherapieplanAnalyzerTest {
|
||||
class TherapieplanAnalyzerTest {
|
||||
|
||||
@Mock
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
@ -13,7 +13,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class PluginConfigurationTest {
|
||||
class PluginConfigurationTest {
|
||||
|
||||
@Mock
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TherapieplanServiceFactoryTest {
|
||||
class TherapieplanServiceFactoryTest {
|
||||
|
||||
@Mock
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
@ -20,7 +20,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class DefaultTherapieplanServiceTest {
|
||||
class DefaultTherapieplanServiceTest {
|
||||
|
||||
@Mock
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
@ -13,7 +13,7 @@ import static org.mockito.Mockito.anyString;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SettingsServiceTest {
|
||||
class SettingsServiceTest {
|
||||
|
||||
@Mock
|
||||
private SettingsRepository settingsRepository;
|
||||
@ -36,8 +36,9 @@ public class SettingsServiceTest {
|
||||
}).when(settingsRepository).findByName(anyString());
|
||||
|
||||
var actual = service.getSID();
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("12345");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("12345");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -51,8 +52,9 @@ public class SettingsServiceTest {
|
||||
}).when(settingsRepository).findByName(anyString());
|
||||
|
||||
var actual = service.getSetting("SID");
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("12345");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("12345");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class StudieTest {
|
||||
class StudieTest {
|
||||
|
||||
@Test
|
||||
void shouldDetectStudieWithNctNumber() {
|
||||
|
@ -17,7 +17,7 @@ import java.util.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class DefaultMtbServiceTest {
|
||||
class DefaultMtbServiceTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
|
@ -16,7 +16,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class MrMtbAnmeldungToProtocolMapperTest {
|
||||
class MrMtbAnmeldungToProtocolMapperTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
@ -76,12 +76,13 @@ public class MrMtbAnmeldungToProtocolMapperTest {
|
||||
|
||||
var actual = this.mapper.apply(anmeldung);
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo(
|
||||
"Fragestellung:\nFrage?\n\n" +
|
||||
"Empfehlung:\nEmpfehlung1\n\n" +
|
||||
"Empfehlung:\nEmpfehlung2"
|
||||
);
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains(
|
||||
"Fragestellung:\nFrage?\n\n"
|
||||
+ "Empfehlung:\nEmpfehlung1\n\n"
|
||||
+ "Empfehlung:\nEmpfehlung2"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -106,8 +107,9 @@ public class MrMtbAnmeldungToProtocolMapperTest {
|
||||
|
||||
var actual = this.mapper.apply(anmeldung);
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("Fragestellung:\nFrage?");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("Fragestellung:\nFrage?");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -119,8 +121,9 @@ public class MrMtbAnmeldungToProtocolMapperTest {
|
||||
|
||||
var actual = this.mapper.apply(anmeldung);
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("Fragestellung:\nFrage?");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("Fragestellung:\nFrage?");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -15,7 +15,7 @@ import java.util.Date;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class OsTumorkonferenzToProtocolMapperTest {
|
||||
class OsTumorkonferenzToProtocolMapperTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
@ -39,8 +39,9 @@ public class OsTumorkonferenzToProtocolMapperTest {
|
||||
|
||||
var actual = mapper.apply(procedure);
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("Fragestellung:\nTest ok?\n\nEmpfehlung:\nRerun Test if not ok!");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("Fragestellung:\nTest ok?\n\nEmpfehlung:\nRerun Test if not ok!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.util.Date;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class OsTumorkonferenzVarianteUkwToProtocolMapperTest {
|
||||
class OsTumorkonferenzVarianteUkwToProtocolMapperTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
@ -39,8 +39,9 @@ public class OsTumorkonferenzVarianteUkwToProtocolMapperTest {
|
||||
|
||||
var actual = mapper.apply(procedure);
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
assertThat(actual.get()).isEqualTo("Fragestellung:\nTest ok?\n\nEmpfehlung:\nRerun Test if not ok!");
|
||||
assertThat(actual)
|
||||
.isPresent()
|
||||
.contains("Fragestellung:\nTest ok?\n\nEmpfehlung:\nRerun Test if not ok!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class DefaultSystemtherapieServiceTest {
|
||||
class DefaultSystemtherapieServiceTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
@ -29,20 +29,14 @@ public class DefaultSystemtherapieServiceTest {
|
||||
private DefaultSystemtherapieService service;
|
||||
|
||||
@BeforeEach
|
||||
void setup(
|
||||
@Mock IOnkostarApi onkostarApi,
|
||||
@Mock SettingsService settingsService
|
||||
) {
|
||||
void setup(@Mock IOnkostarApi onkostarApi, @Mock SettingsService settingsService) {
|
||||
this.onkostarApi = onkostarApi;
|
||||
this.settingsService = settingsService;
|
||||
this.service = new DefaultSystemtherapieService(onkostarApi, settingsService);
|
||||
}
|
||||
|
||||
private static Set<Map.Entry<String, Class<OsSystemischeTherapieToProzedurwerteMapper>>> expectedMapperMappings() {
|
||||
return Map.ofEntries(
|
||||
Map.entry("OS.Systemische Therapie", OsSystemischeTherapieToProzedurwerteMapper.class),
|
||||
Map.entry("OS.Systemische Therapie.VarianteUKW", OsSystemischeTherapieToProzedurwerteMapper.class)
|
||||
).entrySet();
|
||||
return Map.ofEntries(Map.entry("OS.Systemische Therapie", OsSystemischeTherapieToProzedurwerteMapper.class), Map.entry("OS.Systemische Therapie.VarianteUKW", OsSystemischeTherapieToProzedurwerteMapper.class)).entrySet();
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -57,11 +51,7 @@ public class DefaultSystemtherapieServiceTest {
|
||||
}
|
||||
|
||||
private static Set<Map.Entry<String, String>> expectedFormnameMappings() {
|
||||
return Map.ofEntries(
|
||||
Map.entry("2011", "OS.Systemische Therapie.VarianteUKW"),
|
||||
Map.entry("20119", "OS.Systemische Therapie.VarianteUKW"),
|
||||
Map.entry("Defaultwert", "OS.Systemische Therapie")
|
||||
).entrySet();
|
||||
return Map.ofEntries(Map.entry("2011", "OS.Systemische Therapie.VarianteUKW"), Map.entry("20119", "OS.Systemische Therapie.VarianteUKW"), Map.entry("Defaultwert", "OS.Systemische Therapie")).entrySet();
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ -83,8 +73,9 @@ public class DefaultSystemtherapieServiceTest {
|
||||
|
||||
var actual = service.getSystemischeTherapienFromDiagnose(1);
|
||||
|
||||
assertThat(actual).isNotNull();
|
||||
assertThat(actual).isExactlyInstanceOf(ArrayList.class);
|
||||
assertThat(actual).hasSize(1);
|
||||
assertThat(actual)
|
||||
.isNotNull()
|
||||
.isExactlyInstanceOf(ArrayList.class)
|
||||
.hasSize(1);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import java.util.Map;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ProzedurToProzedurwerteMapperTest {
|
||||
class ProzedurToProzedurwerteMapperTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
@ -55,18 +55,12 @@ public class ProzedurToProzedurwerteMapperTest {
|
||||
|
||||
assertThat(actual).isPresent();
|
||||
|
||||
assertThat(actual.get().get("Beginn"))
|
||||
.isEqualTo(Date.from(Instant.parse("2023-01-01T00:00:00Z")).toString());
|
||||
assertThat(actual.get().get("Ende"))
|
||||
.isEqualTo(Date.from(Instant.parse("2023-01-31T00:00:00Z")).toString());
|
||||
assertThat(actual.get().get("Beendigung"))
|
||||
.isEqualTo("E");
|
||||
assertThat(actual.get().get("Ergebnis"))
|
||||
.isEqualTo("T");
|
||||
assertThat(actual.get().get("Wirkstoffe"))
|
||||
.isEqualTo("Testsubstanz, cyclophosphamide");
|
||||
assertThat(actual.get().get("WirkstoffCodes"))
|
||||
.isEqualTo(
|
||||
assertThat(actual.get()).containsEntry("Beginn", Date.from(Instant.parse("2023-01-01T00:00:00Z")).toString());
|
||||
assertThat(actual.get()).containsEntry("Ende", Date.from(Instant.parse("2023-01-31T00:00:00Z")).toString());
|
||||
assertThat(actual.get()).containsEntry("Beendigung", "E");
|
||||
assertThat(actual.get()).containsEntry("Ergebnis", "T");
|
||||
assertThat(actual.get()).containsEntry("Wirkstoffe", "Testsubstanz, cyclophosphamide");
|
||||
assertThat(actual.get()).containsEntry("WirkstoffCodes",
|
||||
"[" +
|
||||
"{\"system\":\"other\",\"code\":\"Testsubstanz\",\"substance\":\"Testsubstanz\"}," +
|
||||
"{\"system\":\"ATC\",\"code\":\"L01AA01\",\"substance\":\"cyclophosphamide\"}" +
|
||||
|
Reference in New Issue
Block a user