Skip to content

Commit

Permalink
changes proposed by reviewers.
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-Draeger committed Feb 22, 2024
1 parent 0e08093 commit 5483f7a
Showing 1 changed file with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package com.draeger.medical.sdccc.tests.util;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
Expand Down Expand Up @@ -1000,7 +1001,6 @@ void testUniqueEpisodicReportBasedHistoryUntilTimestampRegressionWithOperationIn
part.setSourceMds("sourceMds");
report.getReportPart().add(part);
report.setMdibVersion(numericMdibVersion);
report.setSequenceId(sequenceId);
final Envelope soapMessage =
messageBuilder.createSoapMessageWithBody(ActionConstants.ACTION_OPERATION_INVOKED_REPORT, report);

Expand Down Expand Up @@ -1041,19 +1041,22 @@ private void testUniqueEpisodicReportBasedHistoryUntilTimestamp(final String seq

final long timestamp = System.nanoTime();

// when
try (var result = historianUnderTest.uniqueEpisodicReportBasedHistoryUntilTimestamp(sequenceId, timestamp)) {
// then
RemoteMdibAccess lastMdib = null;
RemoteMdibAccess mdib = result.next();
while (mdib != null) {
if (lastMdib != null) {
assertEquals(lastMdib, mdib); // nothing changed
// when & then
assertDoesNotThrow(() -> {
try (var result =
historianUnderTest.uniqueEpisodicReportBasedHistoryUntilTimestamp(sequenceId, timestamp)) {
// then
RemoteMdibAccess lastMdib = null;
RemoteMdibAccess mdib = result.next();
while (mdib != null) {
if (lastMdib != null) {
assertEquals(lastMdib, mdib); // nothing changed
}
lastMdib = mdib;
mdib = result.next();
}
lastMdib = mdib;
mdib = result.next();
}
}
});
}

/**
Expand Down Expand Up @@ -1140,20 +1143,22 @@ void testEpisodicReportBasedHistory(final Envelope report, final String sequence
messageStorageUtil.addInboundSecureHttpMessage(storage, buildMdibEnvelope(sequenceId, BigInteger.ZERO));
messageStorageUtil.addInboundSecureHttpMessage(storage, report);

// when
try (MdibHistorian.HistorianResult historianResult =
historianUnderTest.episodicReportBasedHistory(sequenceId)) {
// then
RemoteMdibAccess lastMdib = null;
RemoteMdibAccess mdib = historianResult.next();
while (mdib != null) {
if (lastMdib != null) {
assertEquals(lastMdib, mdib); // nothing changed
// when & then
assertDoesNotThrow(() -> {
try (MdibHistorian.HistorianResult historianResult =
historianUnderTest.episodicReportBasedHistory(sequenceId)) {
// then
RemoteMdibAccess lastMdib = null;
RemoteMdibAccess mdib = historianResult.next();
while (mdib != null) {
if (lastMdib != null) {
assertEquals(lastMdib, mdib); // nothing changed
}
lastMdib = mdib;
mdib = historianResult.next();
}
lastMdib = mdib;
mdib = historianResult.next();
}
}
});
}

private static LocalizedText createLocalizedText(
Expand Down Expand Up @@ -1190,8 +1195,8 @@ private void testApplyReportOnStorage(

when(mdibAccess.getMdibVersion()).thenReturn(mdibVersion);

// when
historianUnderTest.applyReportOnStorage(mdibAccess, report);
// when & then
assertDoesNotThrow(() -> historianUnderTest.applyReportOnStorage(mdibAccess, report));
}

Envelope buildMdibEnvelope(final String sequenceId, @Nullable final BigInteger mdibVersion) {
Expand Down

0 comments on commit 5483f7a

Please sign in to comment.