Skip to content

Commit

Permalink
🚧 #70 update fallback service test
Browse files Browse the repository at this point in the history
  • Loading branch information
rucko24 committed Oct 31, 2024
1 parent b2ef641 commit a4b2d53
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()
Expand All @@ -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();

}



}

0 comments on commit a4b2d53

Please sign in to comment.