1
0
mirror of https://github.com/pcvolkmer/onkostar-plugin-dnpm.git synced 2025-07-04 10:02:55 +00:00

Methode getVerweise() vereinfacht

This commit is contained in:
2023-03-30 12:05:59 +02:00
parent 2f691efeb3
commit 82ab2234e8
2 changed files with 58 additions and 41 deletions

View File

@ -228,6 +228,23 @@ class DNPMHelperTest {
verify(onkostarApi, times(1)).getSessionFactory();
}
@Test
void testShouldCreateSqlQueryWithPatientId() {
var sessionFactory = mock(SessionFactory.class);
var session = mock(Session.class);
var query = mock(SQLQuery.class);
when(onkostarApi.getSessionFactory()).thenReturn(sessionFactory);
when(sessionFactory.getCurrentSession()).thenReturn(session);
when(session.createSQLQuery(anyString())).thenReturn(query);
dnpmHelper.getVerweise(Map.of("ProcedureId", 1, "PatientId", 2));
var argumentCaptor = ArgumentCaptor.forClass(String.class);
verify(session, times(1)).createSQLQuery(argumentCaptor.capture());
assertThat(argumentCaptor.getValue()).contains("WHERE patient_id = 2 AND geloescht = 0");
}
}
}