### Question:
TierController { protected SaleTier fromRequestToEntity(SaleTierRequest request) { return new SaleTier( request.getTierNo(), request.getDescription(), request.getStartDate(), request.getEndDate(), request.getDiscount(), request.getTomicsSold(), request.getTomicsMax(), request.getHasDynamicDuration(), request.getHasDynamicMax() ); }  @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ResponseStatus(HttpStatus.OK) @ResponseBody ResponseEntity<List<SaleTierResponse>> getAllTiers(); @PostMapping(value = "/create", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) ResponseEntity<List<SaleTierResponse>> createTiers(
            @RequestBody List<SaleTierRequest> tiersRequest);  }### Answer:
@Test public void createTiers_With_Right_Credential() throws Exception { when(saleTierService.getAllSaleTiersOrderByStartDate()) .thenReturn(tiers); Instant now = Instant.now(); SaleTierRequest req1 = new SaleTierRequest(1, "test1", Date.from(now), Date.from(now.plusSeconds(6000)), new BigDecimal("0.5"), new BigInteger("0"), new BigInteger("1000000000"), true, true); List<SaleTierRequest> listRequest = Arrays.asList(req1); SaleTier saleTierEntityRequest = tierController.fromRequestToEntity(req1); when(saleTierService.saveRequireTransaction(any())).thenReturn(saleTierEntityRequest); MvcResult result = this.mockMvc.perform(post(TIERS_CREATE_ENDPOINT) .with(httpBasic("user", "password")) .content(jsonSaleTierRequest.write(listRequest).getJson()) .contentType(APPLICATION_JSON)) .andExpect(status().isOk()) .andDo(print()) .andReturn(); SaleTierResponse resp1 = new SaleTierResponse(1, "test1", SaleTier.StatusType.ACTIVE, Date.from(now), Date.from(now.plusSeconds(6000)), new BigDecimal("0.5"), new BigInteger("0"), new BigInteger("1000000000")); List<SaleTierResponse> listResponse = Arrays.asList(resp1); assertThat(result.getResponse().getContentAsString()).isEqualTo( jsonSaleTierResponse.write(listResponse).getJson()); }