Skip to content

Commit

Permalink
comment test
Browse files Browse the repository at this point in the history
  • Loading branch information
javieralvarezin2 committed Oct 17, 2024
1 parent 0f6fb24 commit c37dab3
Showing 1 changed file with 32 additions and 32 deletions.
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());
// }
//
//}

0 comments on commit c37dab3

Please sign in to comment.