### Question:
AttributeModelAdapter { public static AttributeSearchResponse fromCatalogAPI(AttributeResponse result) { AttributeSearchResponse attributeSearchResponse = new AttributeSearchResponse(); if (inputIsValid(result)) { return attributeSearchResponse; } AttributeResponse.Attributes resultAttributes = result.getAttributes(); attributeSearchResponse.setIncludedResults(result.getIncludedResults().intValue()); AttributeSearchResponse.Attributes attributes = new AttributeSearchResponse.Attributes(); attributeSearchResponse.setAttributes(attributes); for (AttributeType attributeType : resultAttributes.getAttribute()) { attributes.getAttribute().add(attributeType); } return attributeSearchResponse; }  static AttributeSearchResponse fromCatalogAPI(AttributeResponse result);  }### Answer:
@Test public void testFromCatalogAPIWithNullAttributes() throws Exception { AttributeResponse attributeResponse = generateAttributeResponse(); attributeResponse.setAttributes(null); AttributeSearchResponse attributeSearchResponse = AttributeModelAdapter.fromCatalogAPI(attributeResponse); assertTrue(responsesAreEqual(new AttributeSearchResponse(), attributeSearchResponse)); }
@Test public void testFromCatalogAPI() throws Exception { AttributeResponse attributeResponse = generateAttributeResponse(); AttributeSearchResponse attributeSearchResponse = AttributeModelAdapter.fromCatalogAPI(attributeResponse); assertTrue(responsesAreEqual(generateExpectedAttributeSearchResponse(), attributeSearchResponse)); }
@Test public void testWithNullInput() throws Exception { assertTrue(responsesAreEqual(new AttributeSearchResponse(), AttributeModelAdapter.fromCatalogAPI(null))); }