Skip to content

Commit

Permalink
[SELC-5655] feat: Cleaning up the test classes onboarding-ms
Browse files Browse the repository at this point in the history
  • Loading branch information
giampieroferrara authored Oct 3, 2024
1 parent 9221e37 commit 4037d6e
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@TestHTTPEndpoint(AggregatesController.class)
@QuarkusTestResource(MongoTestResource.class)
@TestSecurity(user = "userJwt")
public class AggregatesControllerTest {
class AggregatesControllerTest {

@InjectMock
AggregatesService aggregatesService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
@QuarkusTest
@TestHTTPEndpoint(TokenController.class)
@QuarkusTestResource(MongoTestResource.class)
public class TokenControllerTest {
class TokenControllerTest {

@InjectMock
private TokenService tokenService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import static org.junit.jupiter.api.Assertions.*;

@QuarkusTest
public class ExceptionHandlerTest {
class ExceptionHandlerTest {

ExceptionHandler exceptionHandler = new ExceptionHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


@QuarkusTest
public class AggregatesServiceDefaultTest {
class AggregatesServiceDefaultTest {

@Inject
AggregatesServiceDefault aggregatesServiceDefault;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class NotificationServiceDefaultTest {
@Test
@RunOnVertxContext
@DisplayName("Should return void item and take in charge the notification resend")
public void shouldReturnVoidItemAndTakeInChargeNotificationResend() {
void shouldReturnVoidItemAndTakeInChargeNotificationResend() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("COMPLETED").build();

UniAssertSubscriber<Void> subscriber = notificationServiceDefault.resendOnboardingNotifications(filters)
Expand All @@ -52,7 +52,7 @@ public void shouldReturnVoidItemAndTakeInChargeNotificationResend() {

@Test
@DisplayName("Should try to send all notifications when notifications api calls succeed")
public void shouldTryToSendAllNotifications() {
void shouldTryToSendAllNotifications() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("COMPLETED").build();
mockOnboardingFind();
when(notificationApi.apiNotificationPost(any(), any()))
Expand All @@ -69,7 +69,7 @@ public void shouldTryToSendAllNotifications() {

@Test
@DisplayName("Should try to send all notifications when notifications api calls throw ignorable error")
public void shouldTryToSendAllNotificationsWhenApiThrowIgnorableError() {
void shouldTryToSendAllNotificationsWhenApiThrowIgnorableError() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("COMPLETED").build();
mockOnboardingFind();

Expand All @@ -90,7 +90,7 @@ public void shouldTryToSendAllNotificationsWhenApiThrowIgnorableError() {
@Test
@RunOnVertxContext
@DisplayName("Should not send all notifications when notifications api calls throw non ignorable error")
public void shouldNotSendAllNotificationsWhenApiThrowNonIgnorableError() {
void shouldNotSendAllNotificationsWhenApiThrowNonIgnorableError() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("COMPLETED").build();
mockOnboardingFind();

Expand Down Expand Up @@ -126,23 +126,23 @@ private Onboarding createDummyOnboarding() {

@Test
@DisplayName("Should resend notifications for deleted status")
public void shouldResendNotificationsForDeletedStatus() {
void shouldResendNotificationsForDeletedStatus() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("DELETED").build();

notificationServiceDefault.resendOnboardingNotifications(filters);
}

@Test
@DisplayName("Should throw InvalidRequestException when status is null")
public void shouldThrowInvalidRequestExceptionWhenStatusIsNull() {
void shouldThrowInvalidRequestExceptionWhenStatusIsNull() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().build();

assertThrows(InvalidRequestException.class, () -> notificationServiceDefault.resendOnboardingNotifications(filters));
}

@Test
@DisplayName("Should throw InvalidRequestException when status is not COMPLETED or DELETED")
public void shouldThrowInvalidRequestExceptionWhenStatusIsNotCompletedOrDeleted() {
void shouldThrowInvalidRequestExceptionWhenStatusIsNotCompletedOrDeleted() {
OnboardingGetFilters filters = OnboardingGetFilters.builder().status("INVALID_STATUS").build();

assertThrows(InvalidRequestException.class, () -> notificationServiceDefault.resendOnboardingNotifications(filters));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class OnboardingServiceDefaultTest {
@Spy
OnboardingMapper onboardingMapper = new OnboardingMapperImpl();

final static UserRequest manager = UserRequest.builder()
static final UserRequest manager = UserRequest.builder()
.name("name")
.surname("surname")
.taxCode("taxCode")
Expand Down Expand Up @@ -1986,7 +1986,7 @@ void checkRecipientCodeWithValidResponse() {
.thenReturn(Uni.createFrom().item(uoResource));

// Mock the response from onboardingUtils.validationRecipientCode
when(onboardingUtils.getValidationRecipientCodeError(eq(originId), eq(uoResource)))
when(onboardingUtils.getValidationRecipientCodeError(originId, uoResource))
.thenReturn(Uni.createFrom().item(customError));

// Call the method under test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

@QuarkusTest
@QuarkusTestResource(MongoTestResource.class)
public class TokenServiceDefaultTest {
class TokenServiceDefaultTest {

@Inject
TokenServiceDefault tokenService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.core.JsonProcessingException;
import io.quarkus.test.junit.QuarkusTest;
import it.pagopa.selfcare.onboarding.service.strategy.ConfigMapAllowedListOnboardingValidationStrategy;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import it.pagopa.selfcare.onboarding.exception.InvalidRequestException;
import it.pagopa.selfcare.product.entity.Product;
import jakarta.inject.Inject;
import jakarta.ws.rs.WebApplicationException;
import org.apache.http.HttpStatus;
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.jboss.resteasy.reactive.ClientWebApplicationException;
Expand All @@ -35,7 +34,7 @@
import static org.mockito.Mockito.when;

@QuarkusTest
public class OnboardingUtilsTest {
class OnboardingUtilsTest {

@InjectMock
@RestClient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import it.pagopa.selfcare.onboarding.common.OnboardingStatus;
import it.pagopa.selfcare.onboarding.entity.Billing;
import it.pagopa.selfcare.onboarding.entity.Onboarding;
import jakarta.inject.Inject;
import org.junit.jupiter.api.Test;
import org.wildfly.common.Assert;

import java.time.LocalDateTime;
import java.util.Map;

@QuarkusTest
public class QueryUtilsTest {
class QueryUtilsTest {

@Test
void testOnboardingUpdateMap_recipientCode() {
Expand Down

0 comments on commit 4037d6e

Please sign in to comment.