diff --git a/receivers/jvm/java-receiver/src/test/java/net/zscript/javareceiver/testing/LocalChannelTest.java b/receivers/jvm/java-receiver/src/test/java/net/zscript/javareceiver/testing/LocalChannelTest.java index 51c9f7a0..a433cb2f 100644 --- a/receivers/jvm/java-receiver/src/test/java/net/zscript/javareceiver/testing/LocalChannelTest.java +++ b/receivers/jvm/java-receiver/src/test/java/net/zscript/javareceiver/testing/LocalChannelTest.java @@ -12,6 +12,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import ch.qos.logback.classic.Level; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -105,18 +106,20 @@ public void shouldRegisterFailureOnReadError() throws IOException { when(cmdStream.read(Mockito.any(byte[].class))).thenReturn(0).thenThrow(new IOException("my test exception")); makeItRun(cmdStream); // E3 implies ERROR - assertThat(responseCollector.next()).isPresent().get().isEqualTo("\"LocalChannel\"E3".getBytes(UTF_8)); + assertThat(responseCollector.next()).hasValue("\"LocalChannel\"E3".getBytes(UTF_8)); } @Test public void shouldRegisterClosureOnEOF() throws IOException { + ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger("net.zscript"); + root.setLevel(Level.TRACE); // Force the InputStream to fail final InputStream cmdStream = mock(InputStream.class); when(cmdStream.read(Mockito.any(byte[].class))).thenReturn(-1); makeItRun(cmdStream); // E1 implies CLOSED - assertThat(responseCollector.next()).isPresent().get().isEqualTo("\"LocalChannel\"E1".getBytes(UTF_8)); + assertThat(responseCollector.next()).hasValue("\"LocalChannel\"E1".getBytes(UTF_8)); } private void makeItRun(InputStream cmdStream) throws IOException { @@ -149,6 +152,6 @@ public void shouldOutputChannelInfo() { sequenceOutStream.close(); await().atMost(ofSeconds(5)).until(() -> !responseCollector.isEmpty()); - assertThat(responseCollector.next()).isPresent().get().isEqualTo("\"LocalChannel\"E".getBytes(UTF_8)); + assertThat(responseCollector.next()).hasValue("\"LocalChannel\"E".getBytes(UTF_8)); } }