src/test/java/com/squareup/connect/api/CatalogApiTest.java
@Test
    public void searchCatalogObjectsTest() throws ApiException {
        SearchCatalogObjectsRequest query1 = new SearchCatalogObjectsRequest()
            .query(new CatalogQuery()
                .prefixQuery(new CatalogQueryPrefix().attributeName("name").attributePrefix("Sm")))
            .includeDeletedObjects(false)
            .includeRelatedObjects(false);
        SearchCatalogObjectsResponse response = api.searchCatalogObjects(query1);
        assertEquals(2, response.getObjects().size());

        assertEquals("ITEM_VARIATION", response.getObjects().get(0).getType());
        assertEquals("Small", response.getObjects().get(0).getItemVariationData().getName());
        assertEquals("ITEM_VARIATION", response.getObjects().get(1).getType());
        assertEquals("Small", response.getObjects().get(1).getItemVariationData().getName());

        SearchCatalogObjectsRequest query2 = new SearchCatalogObjectsRequest()
            .query(new CatalogQuery()
                .itemsForTaxQuery(new CatalogQueryItemsForTax().addTaxIdsItem(idMap.get("#SalesTax"))))
            .includeDeletedObjects(false)
            .includeRelatedObjects(false);
        SearchCatalogObjectsResponse response2 = api.searchCatalogObjects(query2);
        assertEquals(2, response2.getObjects().size());
        assertEquals("ITEM", response2.getObjects().get(0).getType());
        assertEquals("ITEM", response2.getObjects().get(1).getType());

        boolean gotCoffee = false;
        boolean gotTea = false;
        for (CatalogObject obj : response2.getObjects()) {
            if (obj.getItemData().getName().equals("Coffee")) {
                gotCoffee = true;
            }
            if (obj.getItemData().getName().equals("Tea")) {
                gotTea = true;
            }
        }
        assertTrue(gotCoffee);
        assertTrue(gotTea);
    }
/**
     * SearchCatalogObjects
     * <p>
     * Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact, ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
     *
     * @throws ApiException if the Api call fails
     */


@throws ApiException if the Api call fails
@throws ApiException if the Api call fails
@Test
    public void searchCatalogObjectsTest() throws ApiException {
        SearchCatalogObjectsRequest query1 = new SearchCatalogObjectsRequest()
            .query(new CatalogQuery()
                .prefixQuery(new CatalogQueryPrefix().attributeName("name").attributePrefix("Sm")))
            .includeDeletedObjects(false)
            .includeRelatedObjects(false);
        SearchCatalogObjectsResponse response = api.searchCatalogObjects(query1);
        assertEquals(2, response.getObjects().size());
        assertEquals("ITEM_VARIATION", response.getObjects().get(0).getType());
        assertEquals("Small", response.getObjects().get(0).getItemVariationData().getName());
        assertEquals("ITEM_VARIATION", response.getObjects().get(1).getType());
        assertEquals("Small", response.getObjects().get(1).getItemVariationData().getName());
        SearchCatalogObjectsRequest query2 = new SearchCatalogObjectsRequest()
            .query(new CatalogQuery()
                .itemsForTaxQuery(new CatalogQueryItemsForTax().addTaxIdsItem(idMap.get("#SalesTax"))))
            .includeDeletedObjects(false)
            .includeRelatedObjects(false);
        SearchCatalogObjectsResponse response2 = api.searchCatalogObjects(query2);
        assertEquals(2, response2.getObjects().size());
        assertEquals("ITEM", response2.getObjects().get(0).getType());
        assertEquals("ITEM", response2.getObjects().get(1).getType());
        boolean gotCoffee = false;
        boolean gotTea = false;
        for (CatalogObject obj : response2.getObjects()) {
            if (obj.getItemData().getName().equals("Coffee")) {
                gotCoffee = true;
            }
            if (obj.getItemData().getName().equals("Tea")) {
                gotTea = true;
            }
        }
        assertTrue(gotCoffee);
        assertTrue(gotTea);
    }
@ Test public void searchCatalogObjectsTest ( ) throws ApiException { SearchCatalogObjectsRequest query1 = new SearchCatalogObjectsRequest ( ) . query ( new CatalogQuery ( ) . prefixQuery ( new CatalogQueryPrefix ( ) . attributeName ( "name" ) . attributePrefix ( "Sm" ) ) ) . includeDeletedObjects ( false ) . includeRelatedObjects ( false ) ; SearchCatalogObjectsResponse response = api . searchCatalogObjects ( query1 ) ; assertEquals ( 2 , response . getObjects ( ) . size ( ) ) ; assertEquals ( "ITEM_VARIATION" , response . getObjects ( ) . get ( 0 ) . getType ( ) ) ; assertEquals ( "Small" , response . getObjects ( ) . get ( 0 ) . getItemVariationData ( ) . getName ( ) ) ; assertEquals ( "ITEM_VARIATION" , response . getObjects ( ) . get ( 1 ) . getType ( ) ) ; assertEquals ( "Small" , response . getObjects ( ) . get ( 1 ) . getItemVariationData ( ) . getName ( ) ) ; SearchCatalogObjectsRequest query2 = new SearchCatalogObjectsRequest ( ) . query ( new CatalogQuery ( ) . itemsForTaxQuery ( new CatalogQueryItemsForTax ( ) . addTaxIdsItem ( idMap . get ( "#SalesTax" ) ) ) ) . includeDeletedObjects ( false ) . includeRelatedObjects ( false ) ; SearchCatalogObjectsResponse response2 = api . searchCatalogObjects ( query2 ) ; assertEquals ( 2 , response2 . getObjects ( ) . size ( ) ) ; assertEquals ( "ITEM" , response2 . getObjects ( ) . get ( 0 ) . getType ( ) ) ; assertEquals ( "ITEM" , response2 . getObjects ( ) . get ( 1 ) . getType ( ) ) ; boolean gotCoffee = false ; boolean gotTea = false ; for ( CatalogObject obj : response2 . getObjects ( ) ) { if ( obj . getItemData ( ) . getName ( ) . equals ( "Coffee" ) ) { gotCoffee = true ; } if ( obj . getItemData ( ) . getName ( ) . equals ( "Tea" ) ) { gotTea = true ; } } assertTrue ( gotCoffee ) ; assertTrue ( gotTea ) ; }
SearchCatalogObjects
 <p>
 Queries the targeted catalog using a variety of query types ([CatalogQuerySortedAttribute](#type-catalogquerysortedattribute), ([CatalogQueryExact](#type-catalogqueryexact, ([CatalogQueryRange](#type-catalogqueryrange), ([CatalogQueryText](#type-catalogquerytext), ([CatalogQueryItemsForTax](#type-catalogqueryitemsfortax), ([CatalogQueryItemsForModifierList](#type-catalogqueryitemsformodifierlist)).
SearchCatalogObjects <p > Queries the targeted catalog using a variety of query types ( [ CatalogQuerySortedAttribute ] ( #type - catalogquerysortedattribute ) ( [ CatalogQueryExact ] ( #type - catalogqueryexact ( [ CatalogQueryRange ] ( #type - catalogqueryrange ) ( [ CatalogQueryText ] ( #type - catalogquerytext ) ( [ CatalogQueryItemsForTax ] ( #type - catalogqueryitemsfortax ) ( [ CatalogQueryItemsForModifierList ] ( #type - catalogqueryitemsformodifierlist )) .