Search in sources :

Example 1 with SearchDoubleCustomField

use of com.netsuite.webservices.test.platform.core.SearchDoubleCustomField in project components by Talend.

the class SearchFieldAdaptersTest method testAdapterForDoubleSearchField.

@Test
public void testAdapterForDoubleSearchField() {
    SearchDoubleFieldAdapter adapter1 = new SearchDoubleFieldAdapter(basicMetaData, SearchFieldType.DOUBLE, SearchDoubleField.class);
    SearchDoubleField field1 = (SearchDoubleField) adapter1.populate(null, "Double.greaterThanOrEqualTo", Arrays.asList("1.25"));
    assertNotNull(field1);
    assertEquals(SearchDoubleFieldOperator.GREATER_THAN_OR_EQUAL_TO, field1.getOperator());
    assertEquals(Double.valueOf(1.25), field1.getSearchValue());
    field1 = (SearchDoubleField) adapter1.populate(null, "Double.between", Arrays.asList("1.05", "1.35"));
    assertEquals(SearchDoubleFieldOperator.BETWEEN, field1.getOperator());
    assertEquals(Double.valueOf(1.05), field1.getSearchValue());
    assertEquals(Double.valueOf(1.35), field1.getSearchValue2());
    field1 = (SearchDoubleField) adapter1.populate(null, "Double.lessThan", null);
    assertEquals(SearchDoubleFieldOperator.LESS_THAN, field1.getOperator());
    assertNull(field1.getSearchValue());
    SearchDoubleFieldAdapter adapter2 = new SearchDoubleFieldAdapter(basicMetaData, SearchFieldType.CUSTOM_DOUBLE, SearchDoubleCustomField.class);
    SearchDoubleCustomField field2 = (SearchDoubleCustomField) adapter2.populate(null, "Double.notEqualTo", Arrays.asList("0.01"));
    assertNotNull(field2);
    assertEquals(SearchDoubleFieldOperator.NOT_EQUAL_TO, field2.getOperator());
    assertEquals(Double.valueOf(0.01), field2.getSearchValue());
}
Also used : SearchDoubleCustomField(com.netsuite.webservices.test.platform.core.SearchDoubleCustomField) SearchDoubleField(com.netsuite.webservices.test.platform.core.SearchDoubleField) Test(org.junit.Test)

Aggregations

SearchDoubleCustomField (com.netsuite.webservices.test.platform.core.SearchDoubleCustomField)1 SearchDoubleField (com.netsuite.webservices.test.platform.core.SearchDoubleField)1 Test (org.junit.Test)1