From a4b2d537167fe6e3972402ac2d501931d3ac7209 Mon Sep 17 00:00:00 2001 From: rubn Date: Thu, 31 Oct 2024 20:18:10 +0100 Subject: [PATCH] :construction: #70 update fallback service test --- .../service/EsptoolFallBackServiceTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/test/java/com/esp/espflow/service/EsptoolFallBackServiceTest.java b/src/test/java/com/esp/espflow/service/EsptoolFallBackServiceTest.java index fc9c3df..e57198c 100644 --- a/src/test/java/com/esp/espflow/service/EsptoolFallBackServiceTest.java +++ b/src/test/java/com/esp/espflow/service/EsptoolFallBackServiceTest.java @@ -1,6 +1,8 @@ package com.esp.espflow.service; import com.esp.espflow.entity.EspDeviceInfo; +import com.esp.espflow.exceptions.CanNotBeReadDeviceException; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -17,6 +19,7 @@ class EsptoolFallBackServiceTest { private EsptoolFallBackService service; @Test + @DisplayName("An EspDeviceInfo is returned with the port only, no exception is returned.") void fallback() { var espDeviceInfo = EspDeviceInfo.builder() @@ -28,4 +31,21 @@ void fallback() { .verifyComplete(); } + + @Test + @DisplayName("When the service returns an empty Set, because there are no available ports, this is not the case when the ports do not have read permissions.") + void fallbackEmptyPorts() { + + StepVerifier.create(this.service.fallbackEmptyPorts()) + .expectError(CanNotBeReadDeviceException.class) + .verify(); + + StepVerifier.create(this.service.fallbackEmptyPorts()) + .expectErrorMatches(error -> error.getMessage().contains("Possibly empty ports")) + .verify(); + + } + + + } \ No newline at end of file