Search in sources :

Example 1 with SearchMultiSelectCustomField

use of com.netsuite.webservices.test.platform.core.SearchMultiSelectCustomField 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());
}
Also used : SearchMultiSelectCustomField(com.netsuite.webservices.test.platform.core.SearchMultiSelectCustomField) SearchMultiSelectField(com.netsuite.webservices.test.platform.core.SearchMultiSelectField) Test(org.junit.Test)

Aggregations

SearchMultiSelectCustomField (com.netsuite.webservices.test.platform.core.SearchMultiSelectCustomField)1 SearchMultiSelectField (com.netsuite.webservices.test.platform.core.SearchMultiSelectField)1 Test (org.junit.Test)1