|
4 | 4 |
|
5 | 5 | package org.opensmartgridplatform.adapter.protocol.dlms.infra.messaging.processors;
|
6 | 6 |
|
| 7 | +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; |
7 | 8 | import static org.mockito.ArgumentMatchers.any;
|
8 | 9 | import static org.mockito.ArgumentMatchers.nullable;
|
9 | 10 | import static org.mockito.ArgumentMatchers.same;
|
|
19 | 20 | import org.junit.jupiter.api.BeforeEach;
|
20 | 21 | import org.junit.jupiter.api.Test;
|
21 | 22 | import org.junit.jupiter.api.extension.ExtendWith;
|
| 23 | +import org.junit.jupiter.params.ParameterizedTest; |
| 24 | +import org.junit.jupiter.params.provider.ValueSource; |
22 | 25 | import org.mockito.InjectMocks;
|
23 | 26 | import org.mockito.Mock;
|
24 | 27 | import org.mockito.junit.jupiter.MockitoExtension;
|
@@ -201,4 +204,19 @@ void processMessageTaskShouldNotUpdateFirmwareWhenFirmwareFileNotAvailable()
|
201 | 204 | same(updateFirmwareRequestDto),
|
202 | 205 | any(MessageMetadata.class));
|
203 | 206 | }
|
| 207 | + |
| 208 | + @ParameterizedTest |
| 209 | + @ValueSource(booleans = {true, false}) |
| 210 | + void testUsesDeviceConnection(final boolean isFirmwareFileAvailable) { |
| 211 | + final String firmwareIdentification = "unavailable"; |
| 212 | + final String deviceIdentification = "unavailableEither"; |
| 213 | + final UpdateFirmwareRequestDto updateFirmwareRequestDto = |
| 214 | + new UpdateFirmwareRequestDto(firmwareIdentification, deviceIdentification); |
| 215 | + |
| 216 | + when(this.firmwareService.isFirmwareFileAvailable(firmwareIdentification)) |
| 217 | + .thenReturn(isFirmwareFileAvailable); |
| 218 | + |
| 219 | + assertThat(this.processor.usesDeviceConnection(updateFirmwareRequestDto)) |
| 220 | + .isEqualTo(isFirmwareFileAvailable); |
| 221 | + } |
204 | 222 | }
|
0 commit comments