@Test
public void testSearchBusinessObjectDefinition()
{

    // Create a business object definition search request.
    BusinessObjectDefinitionSearchRequest request = new BusinessObjectDefinitionSearchRequest(Arrays.asList(
        new BusinessObjectDefinitionSearchFilter(EXCLUSION_SEARCH_FILTER,
            Arrays.asList(new BusinessObjectDefinitionSearchKey(new TagKey(TAG_TYPE, TAG_CODE), INCLUDE_TAG_HIERARCHY)))));
    // Create a business object definition.
    BusinessObjectDefinition businessObjectDefinition =
        new BusinessObjectDefinition(ID, BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, SHORT_DESCRIPTION, BDEF_DISPLAY_NAME,
            Arrays.asList(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1)),
            new DescriptiveBusinessObjectFormat(FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION),
            Arrays.asList(new SampleDataFile(DIRECTORY_PATH, FILE_NAME)), CREATED_BY, UPDATED_BY, UPDATED_ON, NO_BUSINESS_OBJECT_DEFINITION_CHANGE_EVENTS);
    // Create a business object definition search response.
    BusinessObjectDefinitionSearchResponse businessObjectDefinitionSearchResponse =
        new BusinessObjectDefinitionSearchResponse(Arrays.asList(businessObjectDefinition));
    // Create a set of search optional fields.
    Set<String> fields = Sets.newHashSet(FIELD_DATA_PROVIDER_NAME, FIELD_DISPLAY_NAME, FIELD_SHORT_DESCRIPTION);
    // Mock the external calls.
    when(businessObjectDefinitionService.searchBusinessObjectDefinitions(request, fields)).thenReturn(businessObjectDefinitionSearchResponse);
    // Call the method under test.
    BusinessObjectDefinitionSearchResponse result =
        businessObjectDefinitionSearchResponse = businessObjectDefinitionRestController.searchBusinessObjectDefinitions(fields, request);
    // Verify the external calls.
    verify(businessObjectDefinitionService).searchBusinessObjectDefinitions(request, fields);
    verifyNoMoreInteractions(businessObjectDefinitionService);
    // Validate the results.
    assertEquals(businessObjectDefinitionSearchResponse, result);
}