### Question:
MerchantModelAdapter { public static MerchantResponse fromCatalogAPI(MerchantsResponse response) { final MerchantResponse output = new MerchantResponse(); output.setMerchants(convertMerchants(response)); return output; }  static MerchantResponse fromCatalogAPI(MerchantsResponse response);  }### Answer:
@Test public void testFromCatalogAPI() throws Exception { expectedResponse = generateExpectedOutput(); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); }
@Test public void testReviews() throws Exception { MerchantsResponse.Merchant merchant = input.getMerchant().get(0); merchant.setMerchantRating(null); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); MerchantsResponse.Merchant.MerchantRating rating = new MerchantsResponse.Merchant.MerchantRating(); rating.setRating(null); merchant.setMerchantRating(rating); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); MerchRatingType ratingType = new MerchRatingType(); ratingType.setDimensionalAverages(null); rating.setRating(ratingType); expectedResponse = generateExpectedOutput(); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); MerchRatingType.DimensionalAverages averages = new MerchRatingType.DimensionalAverages(); ratingType.setDimensionalAverages(averages); expectedResponse = generateExpectedOutput(); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); averages.getAverage().add(null); expectedResponse = generateExpectedOutput(); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); Average average = new Average(); average.setDimension("averageShipping"); average.setValue(new BigDecimal(4.21)); average.setMax(10); average.setMin(0); averages.getAverage().add(average); expectedResponse = generateExpectedOutput(); Rating outputRating = new Rating(); outputRating.setDimension("averageShipping"); outputRating.setValue(new BigDecimal(4.21)); outputRating.setMax(10); outputRating.setMin(0); expectedResponse.getMerchants().get(0).getRatings().add(outputRating); assertTrue(areEquals(expectedResponse, MerchantModelAdapter.fromCatalogAPI(input))); }