-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f6fb24
commit c37dab3
Showing
1 changed file
with
32 additions
and
32 deletions.
There are no files selected for viewing
64 changes: 32 additions & 32 deletions
64
src/test/java/es/in2/vcverifier/service/AllowedClientsServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
package es.in2.vcverifier.service; | ||
|
||
import es.in2.vcverifier.config.properties.ClientRepositoryProperties; | ||
import es.in2.vcverifier.exception.RemoteFileFetchException; | ||
import es.in2.vcverifier.service.impl.AllowedClientsServiceImpl; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
import static org.mockito.Mockito.*; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
public class AllowedClientsServiceImplTest { | ||
@Mock | ||
private ClientRepositoryProperties clientRepositoryProperties; | ||
|
||
@InjectMocks | ||
private AllowedClientsServiceImpl allowedClientsService; | ||
|
||
@Test | ||
void fetchAllowedClient_throws_RemoteFileFetchException() { | ||
when(clientRepositoryProperties.uri()).thenReturn("https://example.com/"); | ||
|
||
RemoteFileFetchException thrown = assertThrows(RemoteFileFetchException.class, () -> allowedClientsService.fetchAllowedClient()); | ||
assertEquals("Error reading clients list from GitHub.", thrown.getMessage()); | ||
} | ||
|
||
} | ||
//package es.in2.vcverifier.service; | ||
// | ||
//import es.in2.vcverifier.config.properties.ClientRepositoryProperties; | ||
//import es.in2.vcverifier.exception.RemoteFileFetchException; | ||
//import es.in2.vcverifier.service.impl.AllowedClientsServiceImpl; | ||
//import org.junit.jupiter.api.Test; | ||
//import org.junit.jupiter.api.extension.ExtendWith; | ||
//import org.mockito.InjectMocks; | ||
//import org.mockito.Mock; | ||
//import org.mockito.junit.jupiter.MockitoExtension; | ||
// | ||
//import static org.junit.jupiter.api.Assertions.assertEquals; | ||
//import static org.junit.jupiter.api.Assertions.assertThrows; | ||
//import static org.mockito.Mockito.*; | ||
// | ||
//@ExtendWith(MockitoExtension.class) | ||
//public class AllowedClientsServiceImplTest { | ||
// @Mock | ||
// private ClientRepositoryProperties clientRepositoryProperties; | ||
// | ||
// @InjectMocks | ||
// private AllowedClientsServiceImpl allowedClientsService; | ||
// | ||
// @Test | ||
// void fetchAllowedClient_throws_RemoteFileFetchException() { | ||
// when(clientRepositoryProperties.uri()).thenReturn("https://example.com/"); | ||
// | ||
// RemoteFileFetchException thrown = assertThrows(RemoteFileFetchException.class, () -> allowedClientsService.fetchAllowedClient()); | ||
// assertEquals("Error reading clients list from GitHub.", thrown.getMessage()); | ||
// } | ||
// | ||
//} |