Skip to content

Commit

Permalink
GRAD2-2973 - Adding test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
kamal-mohammed committed Nov 13, 2024
1 parent 89b6f84 commit cc05dbd
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -39,8 +40,8 @@ class SchoolControllerIntegrationTest {

@Autowired
private MockMvc mockMvc;
@Autowired
private SchoolService schoolService;
@MockBean
private SchoolService schoolServiceMock;

@Autowired
private SchoolRedisRepository schoolRedisRepository;
Expand Down Expand Up @@ -159,7 +160,7 @@ void testReloadSchoolsIntoCache_shouldReturnOK() throws Exception {

@Test
void testReloadSchoolsIntoCache_shouldReturnUnprocessableEntity() throws Exception {
doThrow(Exception.class).when(schoolService).initializeSchoolCache(true);
doThrow(Exception.class).when(schoolServiceMock).initializeSchoolCache(true);
mockMvc.perform(MockMvcRequestBuilders.put("/api/v2/trax/school/cache/schools")
.with(jwt().jwt(jwt -> jwt.claim("scope", "UPDATE_GRAD_TRAX_CACHE")))
.accept(MediaType.APPLICATION_JSON))
Expand All @@ -176,7 +177,7 @@ void testReloadSchoolDetailssIntoCache_shouldReturnOK() throws Exception {

@Test
void testReloadSchoolDetailsIntoCache_shouldReturnUnprocessableEntity() throws Exception {
doThrow(Exception.class).when(schoolService).initializeSchoolDetailCache(true);
doThrow(Exception.class).when(schoolServiceMock).initializeSchoolDetailCache(true);
mockMvc.perform(MockMvcRequestBuilders.put("/api/v2/trax/school/cache/school-details")
.with(jwt().jwt(jwt -> jwt.claim("scope", "UPDATE_GRAD_TRAX_CACHE")))
.accept(MediaType.APPLICATION_JSON))
Expand Down

0 comments on commit cc05dbd

Please sign in to comment.