use of com.netsuite.webservices.test.platform.core.SearchMultiSelectField in project components by Talend.
the class SearchQueryTest method testSearchMultiSelectField.
@Test
public void testSearchMultiSelectField() throws Exception {
clientService.getMetaDataSource().setCustomMetaDataSource(new TestCustomMetaDataSource());
SearchQuery s1 = clientService.newSearch();
s1.target("custom_record_type_1");
s1.condition(new SearchCondition("Owner", "List.anyOf", Arrays.asList("123456789")));
SearchRecord sr1 = (SearchRecord) s1.toNativeQuery();
assertNotNull(sr1);
Assert.assertEquals(CustomRecordSearch.class, sr1.getClass());
CustomRecordSearch search = (CustomRecordSearch) sr1;
assertNotNull(search.getBasic());
CustomRecordSearchBasic searchBasic = search.getBasic();
assertNotNull(searchBasic.getOwner());
SearchMultiSelectField sf1 = searchBasic.getOwner();
assertNotNull(sf1.getSearchValue());
Assert.assertEquals(1, sf1.getSearchValue().size());
Assert.assertEquals("123456789", sf1.getSearchValue().get(0).getInternalId());
}
use of com.netsuite.webservices.test.platform.core.SearchMultiSelectField in project components by Talend.
the class SearchFieldAdaptersTest method testAdapterForMultiSelectSearchField.
@Test
public void testAdapterForMultiSelectSearchField() {
SearchMultiSelectFieldAdapter adapter1 = new SearchMultiSelectFieldAdapter(basicMetaData, SearchFieldType.MULTI_SELECT, SearchMultiSelectField.class);
SearchMultiSelectField field1 = (SearchMultiSelectField) adapter1.populate(null, "List.anyOf", Arrays.asList("abc"));
assertNotNull(field1);
assertEquals(SearchMultiSelectFieldOperator.ANY_OF, field1.getOperator());
assertNotNull(field1.getSearchValue());
assertEquals(1, field1.getSearchValue().size());
assertEquals("abc", field1.getSearchValue().get(0).getInternalId());
field1 = (SearchMultiSelectField) adapter1.populate(null, "List.noneOf", Collections.emptyList());
assertEquals(SearchMultiSelectFieldOperator.NONE_OF, field1.getOperator());
assertNotNull(field1.getSearchValue());
assertEquals(0, field1.getSearchValue().size());
SearchMultiSelectFieldAdapter adapter2 = new SearchMultiSelectFieldAdapter(basicMetaData, SearchFieldType.CUSTOM_MULTI_SELECT, SearchMultiSelectCustomField.class);
SearchMultiSelectCustomField field2 = (SearchMultiSelectCustomField) adapter2.populate(null, "List.anyOf", Arrays.asList("qwerty"));
assertNotNull(field2);
assertEquals(SearchMultiSelectFieldOperator.ANY_OF, field2.getOperator());
assertEquals(1, field2.getSearchValue().size());
assertEquals("qwerty", field2.getSearchValue().get(0).getInternalId());
}
Aggregations