mirror of
https://github.com/pcvolkmer/onkostar-plugin-dnpm.git
synced 2025-07-02 01:02:55 +00:00
Issue #28: Tests zur Ermittlung von Varianten aus "OS.Molekulargenetik" hinzugefügt
This commit is contained in:
@ -0,0 +1,46 @@
|
||||
package DNPM.analyzer;
|
||||
|
||||
import DNPM.security.DelegatingDataBasedPermissionEvaluator;
|
||||
import DNPM.services.molekulargenetik.MolekulargenetikFormService;
|
||||
import de.itc.onkostar.api.IOnkostarApi;
|
||||
import de.itc.onkostar.api.Procedure;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
class EinzelempfehlungAnalyzerTest {
|
||||
|
||||
private IOnkostarApi onkostarApi;
|
||||
|
||||
private MolekulargenetikFormService molekulargenetikFormService;
|
||||
|
||||
private EinzelempfehlungAnalyzer analyzer;
|
||||
|
||||
@BeforeEach
|
||||
void setup(
|
||||
@Mock IOnkostarApi onkostarApi,
|
||||
@Mock MolekulargenetikFormService molekulargenetikFormService,
|
||||
@Mock DelegatingDataBasedPermissionEvaluator permissionEvaluator
|
||||
) {
|
||||
this.onkostarApi = onkostarApi;
|
||||
this.molekulargenetikFormService = molekulargenetikFormService;
|
||||
this.analyzer = new EinzelempfehlungAnalyzer(onkostarApi, molekulargenetikFormService, permissionEvaluator);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShouldRequestVariantsFromMolekulargenetikFormService() {
|
||||
doAnswer(invocationOnMock -> new Procedure(this.onkostarApi)).when(onkostarApi).getProcedure(anyInt());
|
||||
|
||||
analyzer.getVariants(Map.of("id", 123));
|
||||
verify(molekulargenetikFormService, times(1)).getVariants(any(Procedure.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package DNPM.services.molekulargenetik;
|
||||
|
||||
import de.itc.onkostar.api.Item;
|
||||
import de.itc.onkostar.api.Procedure;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class OsMolekluargenetikFormServiceTest {
|
||||
|
||||
private OsMolekulargenetikFormService service;
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
this.service = new OsMolekulargenetikFormService();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testShouldReturnVariants() {
|
||||
|
||||
var procedure = new Procedure(null);
|
||||
procedure.setId(123);
|
||||
procedure.setFormName("OS.Molekulargenetik");
|
||||
|
||||
var subProcedure1 = new Procedure(null);
|
||||
subProcedure1.setId(1123);
|
||||
subProcedure1.setFormName("OS.Molekulargenetische Untersuchung");
|
||||
subProcedure1.setValue("Ergebnis", new Item("Ergebnis", "P"));
|
||||
subProcedure1.setValue("Untersucht", new Item("Untersucht", "BRAF"));
|
||||
subProcedure1.setValue("ExonInt", new Item("ExonInt", 123));
|
||||
subProcedure1.setValue("Pathogenitaetsklasse", new Item("Pathogenitaetsklasse", "2"));
|
||||
procedure.addSubProcedure("MolekulargenetischeUntersuchung", subProcedure1);
|
||||
|
||||
var subProcedure2 = new Procedure(null);
|
||||
subProcedure2.setId(2123);
|
||||
subProcedure2.setFormName("OS.Molekulargenetische Untersuchung");
|
||||
subProcedure2.setValue("Ergebnis", new Item("Ergebnis", "CNV"));
|
||||
subProcedure2.setValue("Untersucht", new Item("Untersucht", "BRAF"));
|
||||
subProcedure2.setValue("ExonInt", new Item("ExonInt", 123));
|
||||
subProcedure2.setValue("Pathogenitaetsklasse", new Item("Pathogenitaetsklasse", "2"));
|
||||
procedure.addSubProcedure("MolekulargenetischeUntersuchung", subProcedure2);
|
||||
|
||||
var actual = service.getVariants(procedure);
|
||||
|
||||
assertThat(actual).hasSize(2);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user