### Question:
ConsignPriceServiceImpl implements ConsignPriceService { @Override public Response getPriceByWeightAndRegion(double weight, boolean isWithinRegion, HttpHeaders headers) { ConsignPrice priceConfig = repository.findByIndex(0); double price = 0; double initialPrice = priceConfig.getInitialPrice(); if (weight <= priceConfig.getInitialWeight()) { price = initialPrice; } else { double extraWeight = weight - priceConfig.getInitialWeight(); if (isWithinRegion) { price = initialPrice + extraWeight * priceConfig.getWithinPrice(); }else { price = initialPrice + extraWeight * priceConfig.getBeyondPrice(); } } return new Response<>(1, success, price); }  @Override Response getPriceByWeightAndRegion(double weight, boolean isWithinRegion, HttpHeaders headers); @Override Response queryPriceInformation(HttpHeaders headers); @Override Response createAndModifyPrice(ConsignPrice config, HttpHeaders headers); @Override Response getPriceConfig(HttpHeaders headers);  }### Answer:
@Test public void testGetPriceByWeightAndRegion1() { ConsignPrice priceConfig = new ConsignPrice(UUID.randomUUID(), 1, 2.0, 3.0, 3.5, 4.0); Mockito.when(repository.findByIndex(0)).thenReturn(priceConfig); Response result = consignPriceServiceImpl.getPriceByWeightAndRegion(1.0, true, headers); Assert.assertEquals(new Response<>(1, "Success", 3.0), result); }
@Test public void testGetPriceByWeightAndRegion2() { ConsignPrice priceConfig = new ConsignPrice(UUID.randomUUID(), 1, 2.0, 3.0, 3.5, 4.0); Mockito.when(repository.findByIndex(0)).thenReturn(priceConfig); Response result = consignPriceServiceImpl.getPriceByWeightAndRegion(3.0, true, headers); Assert.assertEquals(new Response<>(1, "Success", 6.5), result); }
@Test public void testGetPriceByWeightAndRegion3() { ConsignPrice priceConfig = new ConsignPrice(UUID.randomUUID(), 1, 2.0, 3.0, 3.5, 4.0); Mockito.when(repository.findByIndex(0)).thenReturn(priceConfig); Response result = consignPriceServiceImpl.getPriceByWeightAndRegion(3.0, false, headers); Assert.assertEquals(new Response<>(1, "Success", 7.0), result); }