Skip to content

Commit

Permalink
#fix apitest #ana
Browse files Browse the repository at this point in the history
  • Loading branch information
anaacr91 committed Dec 12, 2024
1 parent 55b2afd commit 558e832
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.movies.controller.PartialIntegratedTest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.movies.controller.CustomerApiController;
import com.movies.model.Customer;
import com.movies.repository.CustomerRepository;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -11,7 +12,9 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.server.ResponseStatusException;

import java.util.Arrays;
Expand All @@ -27,6 +30,10 @@ public class CustomerApiPartialIntegratedTest {
@Autowired
private MockMvc mockMvc;

@Autowired
private CustomerApiController customerApiController;


@MockBean
private CustomerRepository customerRepository;

Expand Down Expand Up @@ -225,13 +232,6 @@ public void testDeleteAll_Conflict() throws Exception {
verify(customerRepository).deleteAllByIdInBatch(ids);
}

@Test
public void testDeleteAll_BadRequest() throws Exception {
mockMvc.perform(delete("/api/customers/deleteAll")
.contentType(MediaType.APPLICATION_JSON)
.content(asJsonString(null)))
.andExpect(status().isBadRequest());
}

private static String asJsonString(final Object obj) {
try {
Expand Down

0 comments on commit 558e832

Please sign in to comment.