use of com.netsuite.webservices.test.platform.core.SearchRecord in project components by Talend.
the class SearchQueryTest method testSearchForSpecialRecordTypes.
@Test
public void testSearchForSpecialRecordTypes() throws Exception {
SearchQuery s1 = clientService.newSearch();
s1.target("Address");
s1.condition(new SearchCondition("Country", "List.anyOf", Arrays.asList("Ukraine")));
s1.condition(new SearchCondition("CustomStringField1", "String.contains", Arrays.asList("abc")));
SearchRecord sr1 = (SearchRecord) s1.toNativeQuery();
assertNotNull(sr1);
Assert.assertEquals(AddressSearchBasic.class, sr1.getClass());
AddressSearchBasic search = (AddressSearchBasic) sr1;
assertNotNull(search.getCountry());
SearchEnumMultiSelectField field1 = search.getCountry();
assertNotNull(field1);
Assert.assertEquals(SearchEnumMultiSelectFieldOperator.ANY_OF, field1.getOperator());
assertNotNull(field1.getSearchValue());
Assert.assertEquals(1, field1.getSearchValue().size());
Assert.assertEquals(Arrays.asList("Ukraine"), field1.getSearchValue());
SearchCustomFieldList customFieldList = search.getCustomFieldList();
assertNotNull(customFieldList);
assertNotNull(customFieldList.getCustomField());
Assert.assertEquals(1, customFieldList.getCustomField().size());
SearchStringCustomField customField1 = (SearchStringCustomField) customFieldList.getCustomField().get(0);
assertNotNull(customField1.getOperator());
Assert.assertEquals(SearchStringFieldOperator.CONTAINS, customField1.getOperator());
assertNotNull(customField1.getSearchValue());
Assert.assertEquals("abc", customField1.getSearchValue());
}
Aggregations