Search in sources :

Example 1 with JAIExtRangeValues

use of com.sldeditor.rendertransformation.types.JAIExtRangeValues in project sldeditor by robward-scisys.

the class JAIExtRangeValuesTest method testJAIExtRangeValues.

/**
 * Test method for {@link
 * com.sldeditor.rendertransformation.types.JAIExtRangeValues#JAIExtRangeValues()}.
 */
@Test
void testJAIExtRangeValues() {
    JAIExtRangeValues testObj = new JAIExtRangeValues();
    testObj.createInstance();
    assertEquals(Arrays.asList(Range.class), testObj.getType());
    Range range = RangeFactory.create(0.0, true, 50.0, true, false);
    testObj.setDefaultValue(range);
    assertNull(testObj.getExpression());
    // Range value
    testObj.setValue(range);
    assertNull(testObj.getExpression());
    // Literal expression
    Expression expectedExpression = ff.literal(range);
    testObj.setValue(expectedExpression);
    assertEquals(expectedExpression, testObj.getExpression());
    // Attribute expression
    expectedExpression = ff.property("test");
    testObj.setValue(expectedExpression);
    assertEquals(expectedExpression, testObj.getExpression());
    // Not set
    testObj.setValue("");
    assertNull(testObj.getExpression());
    FieldConfigBase field = testObj.getField(new FieldConfigCommonData(JAIExtRangeValues.class, FieldIdEnum.INITIAL_GAP, "label", true, false, false));
    assertEquals(FieldConfigRange.class, field.getClass());
    // Increase code coverage
    TestJAIExtRangeValues testObj2 = new TestJAIExtRangeValues();
    testObj2.populateSymbolType(null);
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) JAIExtRangeValues(com.sldeditor.rendertransformation.types.JAIExtRangeValues) Range(it.geosolutions.jaiext.range.Range) FieldConfigRange(com.sldeditor.ui.detail.config.FieldConfigRange) Test(org.junit.jupiter.api.Test)

Aggregations

JAIExtRangeValues (com.sldeditor.rendertransformation.types.JAIExtRangeValues)1 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)1 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)1 FieldConfigRange (com.sldeditor.ui.detail.config.FieldConfigRange)1 Range (it.geosolutions.jaiext.range.Range)1 Test (org.junit.jupiter.api.Test)1 Expression (org.opengis.filter.expression.Expression)1