mirror of
https://github.com/pcvolkmer/mv64e-onkostar-data.git
synced 2025-09-13 16:02:52 +00:00
test: multiple choice fields
This commit is contained in:
@@ -25,6 +25,7 @@ import dev.pcvolkmer.onco.datamapper.exceptions.DataAccessException;
|
|||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,11 +67,24 @@ public abstract class AbstractDataCatalogue implements DataCatalogue {
|
|||||||
throw new DataAccessException("Multiple records found for id: " + id);
|
throw new DataAccessException("Multiple records found for id: " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResultSet.from(result.get(0));
|
var resultSet = ResultSet.from(result.get(0));
|
||||||
|
|
||||||
|
if (resultSet.getRawData().containsKey("id")) {
|
||||||
|
var merkmale = getMerkmaleById(resultSet.getId());
|
||||||
|
if (merkmale.isEmpty()) {
|
||||||
|
return resultSet;
|
||||||
|
}
|
||||||
|
merkmale.forEach((key, value) ->
|
||||||
|
resultSet.getRawData().put(key, value)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns related diseases
|
* Returns related diseases
|
||||||
|
*
|
||||||
* @param procedureId The procedure id
|
* @param procedureId The procedure id
|
||||||
* @return the diseases
|
* @return the diseases
|
||||||
*/
|
*/
|
||||||
@@ -86,4 +100,32 @@ public abstract class AbstractDataCatalogue implements DataCatalogue {
|
|||||||
.map(ResultSet::from)
|
.map(ResultSet::from)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get procedure "Merkmale" result by procedure id and form field name
|
||||||
|
*
|
||||||
|
* @param id The parents procedure id
|
||||||
|
* @return The sub procedures
|
||||||
|
*/
|
||||||
|
Map<String, List<String>> getMerkmaleById(int id) {
|
||||||
|
try {
|
||||||
|
var resultSet = this.jdbcTemplate.queryForList(
|
||||||
|
String.format(
|
||||||
|
"SELECT feldname, feldwert FROM %s_merkmale WHERE eintrag_id = ?",
|
||||||
|
getTableName()
|
||||||
|
),
|
||||||
|
id);
|
||||||
|
|
||||||
|
return resultSet.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.groupingBy(
|
||||||
|
m -> m.get("feldname").toString(),
|
||||||
|
Collectors.mapping(stringObjectMap -> stringObjectMap.get("feldwert").toString(), Collectors.toList())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} catch (org.springframework.dao.DataAccessException e) {
|
||||||
|
return Map.of();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -72,31 +72,4 @@ public abstract class AbstractSubformDataCatalogue extends AbstractDataCatalogue
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get procedure "Merkmale" result by procedure id and form field name
|
|
||||||
*
|
|
||||||
* @param id The parents procedure id
|
|
||||||
* @return The sub procedures
|
|
||||||
*/
|
|
||||||
Map<String, List<String>> getMerkmaleById(int id) {
|
|
||||||
try {
|
|
||||||
var resultSet = this.jdbcTemplate.queryForList(
|
|
||||||
String.format(
|
|
||||||
"SELECT feldname, feldwert FROM %s_merkmale WHERE eintrag_id = ?",
|
|
||||||
getTableName()
|
|
||||||
),
|
|
||||||
id);
|
|
||||||
|
|
||||||
return resultSet.stream()
|
|
||||||
.collect(
|
|
||||||
Collectors.groupingBy(
|
|
||||||
m -> m.get("feldname").toString(),
|
|
||||||
Collectors.mapping(stringObjectMap -> stringObjectMap.get("feldwert").toString(), Collectors.toList())
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} catch (DataAccessException e) {
|
|
||||||
return Map.of();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
package dev.pcvolkmer.onco.datamapper.datacatalogues;
|
||||||
|
|
||||||
|
import dev.pcvolkmer.onco.datamapper.ResultSet;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.extension.ExtendWith;
|
import org.junit.jupiter.api.extension.ExtendWith;
|
||||||
@@ -28,14 +29,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class EcogCatalogueTest {
|
class EcogCatalogueTest {
|
||||||
@@ -79,4 +81,47 @@ class EcogCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_ecog.*, prozedur.* FROM dk_dnpm_uf_ecog JOIN prozedur ON (prozedur.id = dk_dnpm_uf_ecog.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_ecog.*, prozedur.* FROM dk_dnpm_uf_ecog JOIN prozedur ON (prozedur.id = dk_dnpm_uf_ecog.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_ecog_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class EinzelempfehlungCatalogueTest {
|
class EinzelempfehlungCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class EinzelempfehlungCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_einzelempfehlung.*, prozedur.* FROM dk_dnpm_uf_einzelempfehlung JOIN prozedur ON (prozedur.id = dk_dnpm_uf_einzelempfehlung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_einzelempfehlung.*, prozedur.* FROM dk_dnpm_uf_einzelempfehlung JOIN prozedur ON (prozedur.id = dk_dnpm_uf_einzelempfehlung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_einzelempfehlung_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class HistologieCatalogueTest {
|
class HistologieCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class HistologieCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_histologie.*, prozedur.* FROM dk_dnpm_uf_histologie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_histologie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_histologie.*, prozedur.* FROM dk_dnpm_uf_histologie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_histologie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_histologie_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,14 +30,15 @@ import org.mockito.junit.jupiter.MockitoExtension;
|
|||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.jdbc.core.RowMapper;
|
import org.springframework.jdbc.core.RowMapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.mockito.ArgumentMatchers.*;
|
import static org.mockito.ArgumentMatchers.*;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class KpaCatalogueTest {
|
class KpaCatalogueTest {
|
||||||
@@ -75,4 +76,47 @@ class KpaCatalogueTest {
|
|||||||
assertThat(ex).hasMessage("No record found for case: 16000123");
|
assertThat(ex).hasMessage("No record found for case: 16000123");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_kpa_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class MolekulargenetikCatalogueTest {
|
class MolekulargenetikCatalogueTest {
|
||||||
@@ -64,4 +65,47 @@ class MolekulargenetikCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_molekulargenetik.*, prozedur.* FROM dk_molekulargenetik JOIN prozedur ON (prozedur.id = dk_molekulargenetik.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND prozedur.id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_molekulargenetik.*, prozedur.* FROM dk_molekulargenetik JOIN prozedur ON (prozedur.id = dk_molekulargenetik.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND prozedur.id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_molekulargenetik_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class MolekulargenuntersuchungCatalogueTest {
|
class MolekulargenuntersuchungCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class MolekulargenuntersuchungCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_molekulargenuntersuchung.*, prozedur.* FROM dk_molekulargenuntersuchung JOIN prozedur ON (prozedur.id = dk_molekulargenuntersuchung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_molekulargenuntersuchung.*, prozedur.* FROM dk_molekulargenuntersuchung JOIN prozedur ON (prozedur.id = dk_molekulargenuntersuchung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_molekulargenuntersuchung_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class ProzedurCatalogueTest {
|
class ProzedurCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class ProzedurCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_prozedur.*, prozedur.* FROM dk_dnpm_uf_prozedur JOIN prozedur ON (prozedur.id = dk_dnpm_uf_prozedur.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_prozedur.*, prozedur.* FROM dk_dnpm_uf_prozedur JOIN prozedur ON (prozedur.id = dk_dnpm_uf_prozedur.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_prozedur_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class RebiopsieCatalogueTest {
|
class RebiopsieCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class RebiopsieCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_rebiopsie.*, prozedur.* FROM dk_dnpm_uf_rebiopsie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_rebiopsie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_rebiopsie.*, prozedur.* FROM dk_dnpm_uf_rebiopsie JOIN prozedur ON (prozedur.id = dk_dnpm_uf_rebiopsie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_rebiopsie_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class ReevaluationCatalogueTest {
|
class ReevaluationCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class ReevaluationCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_reevaluation.*, prozedur.* FROM dk_dnpm_uf_reevaluation JOIN prozedur ON (prozedur.id = dk_dnpm_uf_reevaluation.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_reevaluation.*, prozedur.* FROM dk_dnpm_uf_reevaluation JOIN prozedur ON (prozedur.id = dk_dnpm_uf_reevaluation.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_reevaluation_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class TherapielinieCatalogueTest {
|
class TherapielinieCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class TherapielinieCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_therapielinie.*, prozedur.* FROM dk_dnpm_therapielinie JOIN prozedur ON (prozedur.id = dk_dnpm_therapielinie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_therapielinie.*, prozedur.* FROM dk_dnpm_therapielinie JOIN prozedur ON (prozedur.id = dk_dnpm_therapielinie.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_therapielinie_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class TherapieplanCatalogueTest {
|
class TherapieplanCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class TherapieplanCatalogueTest {
|
|||||||
.isEqualTo("SELECT prozedur.id AS procedure_id FROM dk_dnpm_therapieplan JOIN prozedur ON (prozedur.id = dk_dnpm_therapieplan.id) WHERE geloescht = 0 AND ref_dnpm_klinikanamnese = ?");
|
.isEqualTo("SELECT prozedur.id AS procedure_id FROM dk_dnpm_therapieplan JOIN prozedur ON (prozedur.id = dk_dnpm_therapieplan.id) WHERE geloescht = 0 AND ref_dnpm_klinikanamnese = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_therapieplan_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class TumorausbreitungCatalogueTest {
|
class TumorausbreitungCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class TumorausbreitungCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_tumorausbreitung.*, prozedur.* FROM dk_dnpm_uf_tumorausbreitung JOIN prozedur ON (prozedur.id = dk_dnpm_uf_tumorausbreitung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_tumorausbreitung.*, prozedur.* FROM dk_dnpm_uf_tumorausbreitung JOIN prozedur ON (prozedur.id = dk_dnpm_uf_tumorausbreitung.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_tumorausbreitung_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class TumorgradingCatalogueTest {
|
class TumorgradingCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class TumorgradingCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_tumorgrading.*, prozedur.* FROM dk_dnpm_uf_tumorgrading JOIN prozedur ON (prozedur.id = dk_dnpm_uf_tumorgrading.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_tumorgrading.*, prozedur.* FROM dk_dnpm_uf_tumorgrading JOIN prozedur ON (prozedur.id = dk_dnpm_uf_tumorgrading.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_tumorgrading_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class VerwandteCatalogueTest {
|
class VerwandteCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class VerwandteCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_verwandte.*, prozedur.* FROM dk_dnpm_uf_verwandte JOIN prozedur ON (prozedur.id = dk_dnpm_uf_verwandte.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_verwandte.*, prozedur.* FROM dk_dnpm_uf_verwandte JOIN prozedur ON (prozedur.id = dk_dnpm_uf_verwandte.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_verwandte_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,14 +28,15 @@ import org.mockito.Mock;
|
|||||||
import org.mockito.junit.jupiter.MockitoExtension;
|
import org.mockito.junit.jupiter.MockitoExtension;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.*;
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension.class)
|
@ExtendWith(MockitoExtension.class)
|
||||||
class VorbefundeCatalogueTest {
|
class VorbefundeCatalogueTest {
|
||||||
@@ -79,4 +80,47 @@ class VorbefundeCatalogueTest {
|
|||||||
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_vorbefunde.*, prozedur.* FROM dk_dnpm_uf_vorbefunde JOIN prozedur ON (prozedur.id = dk_dnpm_uf_vorbefunde.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
.isEqualTo("SELECT patient.patienten_id, dk_dnpm_uf_vorbefunde.*, prozedur.* FROM dk_dnpm_uf_vorbefunde JOIN prozedur ON (prozedur.id = dk_dnpm_uf_vorbefunde.id) JOIN patient ON (patient.id = prozedur.patient_id) WHERE geloescht = 0 AND hauptprozedur_id = ?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseCorrectMerkmalQuery(@Mock Map<String, Object> resultSet) {
|
||||||
|
when(resultSet.get(anyString()))
|
||||||
|
.thenReturn(Map.of("feldname", "name", "feldwert", "wert"));
|
||||||
|
|
||||||
|
doAnswer(invocationOnMock -> List.of(resultSet))
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
this.catalogue.getMerkmaleById(1);
|
||||||
|
|
||||||
|
var captor = ArgumentCaptor.forClass(String.class);
|
||||||
|
verify(this.jdbcTemplate).queryForList(captor.capture(), anyInt());
|
||||||
|
|
||||||
|
assertThat(captor.getValue())
|
||||||
|
.isEqualTo("SELECT feldname, feldwert FROM dk_dnpm_uf_vorbefunde_merkmale WHERE eintrag_id = ?");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void shouldUseMerkmalList() {
|
||||||
|
doAnswer(invocationOnMock -> {
|
||||||
|
var sql = invocationOnMock.getArgument(0, String.class);
|
||||||
|
ArrayList<Map<String, Object>> result = new ArrayList<>();
|
||||||
|
if (sql.startsWith("SELECT feldname")) {
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert1"));
|
||||||
|
result.add(Map.of("feldname", "name", "feldwert", "wert2"));
|
||||||
|
} else {
|
||||||
|
var map = new HashMap<String, Object>();
|
||||||
|
map.put("id", 1);
|
||||||
|
map.put("name", "x");
|
||||||
|
result.add(map);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
})
|
||||||
|
.when(jdbcTemplate)
|
||||||
|
.queryForList(anyString(), anyInt());
|
||||||
|
|
||||||
|
var result = this.catalogue.getById(1);
|
||||||
|
|
||||||
|
assertThat(result.getInteger("id")).isEqualTo(1);
|
||||||
|
assertThat(result.getMerkmalList("name")).isEqualTo(List.of("wert1", "wert2"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user