Skip to content

Commit

Permalink
feat: CARITAS-286
Browse files Browse the repository at this point in the history
* fix current tests
  • Loading branch information
Leandro13Silva13 committed Oct 28, 2024
1 parent 54d3aa8 commit 5c76bcf
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.google.common.collect.Lists;
import de.caritas.cob.agencyservice.AgencyServiceApplication;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.util.AuthenticatedUser;
import de.caritas.cob.agencyservice.api.model.Sort;
import de.caritas.cob.agencyservice.api.model.Sort.FieldEnum;
Expand Down Expand Up @@ -38,6 +39,9 @@ class AgencyAdminSearchServiceIT {
@Autowired
private AgencyAdminSearchService agencyAdminSearchService;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@MockBean
private AuthenticatedUser authenticatedUser;

Expand Down Expand Up @@ -160,4 +164,4 @@ private AdminAgencyResponseDTO getAdminAgencies(Long... agencyIds) {
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.collect.Lists;
import de.caritas.cob.agencyservice.AgencyServiceApplication;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.util.AuthenticatedUser;
import de.caritas.cob.agencyservice.api.model.Sort;
import de.caritas.cob.agencyservice.api.service.securityheader.SecurityHeaderSupplier;
Expand Down Expand Up @@ -34,6 +35,9 @@ class AgencyAdminSearchTenantSupportServiceTest {
@Autowired
private AgencyAdminSearchTenantSupportService agencyAdminSearchTenantSupportService;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@MockBean
private AuthenticatedUser authenticatedUser;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package de.caritas.cob.agencyservice.api.controller;

import de.caritas.cob.agencyservice.AgencyServiceApplication;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
Expand All @@ -25,6 +27,9 @@ class ActuatorControllerIT {

@Autowired private WebApplicationContext context;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

private MockMvc mockMvc;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.anyInt;
import static org.mockito.Mockito.when;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity;
Expand All @@ -18,6 +17,7 @@
import de.caritas.cob.agencyservice.api.model.DataProtectionContactDTO;
import de.caritas.cob.agencyservice.api.model.DataProtectionDTO;
import de.caritas.cob.agencyservice.api.service.TenantService;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.util.AuthenticatedUser;
import de.caritas.cob.agencyservice.api.manager.consultingtype.ConsultingTypeManager;
import de.caritas.cob.agencyservice.api.model.AgencyDTO;
Expand All @@ -40,7 +40,6 @@
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
Expand All @@ -60,6 +59,9 @@ class AgencyAdminControllerIT {
@MockBean
private ConsultingTypeManager consultingTypeManager;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@Autowired
private WebApplicationContext context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import de.caritas.cob.agencyservice.api.service.TenantService;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.util.AuthenticatedUser;
import de.caritas.cob.agencyservice.api.manager.consultingtype.ConsultingTypeManager;
import de.caritas.cob.agencyservice.api.model.AgencyDTO;
Expand Down Expand Up @@ -54,6 +55,9 @@ class AgencyAdminControllerWithDemographicsIT {
@MockBean
private ConsultingTypeManager consultingTypeManager;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@Autowired
private WebApplicationContext context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
import static de.caritas.cob.agencyservice.testHelper.TestConstants.VALID_AGE_QUERY;
import static de.caritas.cob.agencyservice.testHelper.TestConstants.VALID_CONSULTING_TYPE_QUERY;
import static de.caritas.cob.agencyservice.testHelper.TestConstants.VALID_POSTCODE_QUERY;
import static org.apache.commons.lang3.exception.ExceptionUtils.getStackTrace;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
Expand All @@ -28,6 +26,7 @@
import de.caritas.cob.agencyservice.api.model.FullAgencyResponseDTO;
import de.caritas.cob.agencyservice.api.service.AgencyService;
import de.caritas.cob.agencyservice.api.service.LogService;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.config.security.AuthorisationService;
import de.caritas.cob.agencyservice.config.security.JwtAuthConverter;
import de.caritas.cob.agencyservice.config.security.JwtAuthConverterProperties;
Expand Down Expand Up @@ -56,6 +55,9 @@ class AgencyControllerIT {
@Autowired
private MockMvc mvc;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@MockBean
private AgencyService agencyService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import de.caritas.cob.agencyservice.api.exception.MissingConsultingTypeException;
import de.caritas.cob.agencyservice.api.manager.consultingtype.ConsultingTypeManager;

import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.tenant.TenantContext;

import jakarta.transaction.Transactional;
Expand All @@ -28,7 +29,6 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
Expand All @@ -54,6 +54,9 @@ public void setup() {
@MockBean
private ConsultingTypeManager consultingTypeManager;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@Autowired
private WebApplicationContext context;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import static de.caritas.cob.agencyservice.testHelper.PathConstants.PATH_GET_AGENCIES_WITH_IDS;
import static de.caritas.cob.agencyservice.testHelper.PathConstants.PATH_GET_LIST_OF_AGENCIES;
import static de.caritas.cob.agencyservice.testHelper.TestConstants.VALID_AGE_QUERY;
import static de.caritas.cob.agencyservice.testHelper.TestConstants.VALID_GENDER_QUERY;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.when;
Expand All @@ -14,6 +12,7 @@

import de.caritas.cob.agencyservice.api.exception.MissingConsultingTypeException;
import de.caritas.cob.agencyservice.api.manager.consultingtype.ConsultingTypeManager;
import de.caritas.cob.agencyservice.api.service.TopicEnrichmentService;
import de.caritas.cob.agencyservice.api.tenant.TenantContext;
import de.caritas.cob.agencyservice.applicationsettingsservice.generated.ApiClient;
import de.caritas.cob.agencyservice.applicationsettingsservice.generated.web.model.ApplicationSettingsDTO;
Expand All @@ -32,7 +31,6 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -63,6 +61,9 @@ public void setup() {
@MockBean
private ConsultingTypeManager consultingTypeManager;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@MockBean
private ApplicationSettingsApiControllerFactory applicationSettingsApiControllerFactory;
@MockBean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class CentralDataProtectionTemplateServiceTest {
@Autowired
CentralDataProtectionTemplateService centralDataProtectionTemplateService;

@MockBean
private TopicEnrichmentService topicEnrichmentService;

@MockBean
TenantService tenantService;

Expand Down Expand Up @@ -313,4 +316,4 @@ private AgencyContextDTO getAgencyContext() {
}


}
}

0 comments on commit 5c76bcf

Please sign in to comment.