/
PaletteStyleHandlerTest.java
38 lines (29 loc) · 1.21 KB
/
PaletteStyleHandlerTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* (c) 2016 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root
* application directory.
*/
package org.geoserver.wms.style;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.geotools.styling.StyledLayerDescriptor;
import org.junit.Test;
import org.opengis.filter.expression.Function;
public class PaletteStyleHandlerTest {
PaletteStyleHandler handler = new PaletteStyleHandler();
@Test
public void testParse() throws Exception {
StyledLayerDescriptor sld = handler.parse("#000000\n#FFFFFF", null, null, null);
Function cm = PaletteParserTest.assertDynamicColorColormap(sld);
assertEquals("rgb(0,0,0);rgb(255,255,255)", cm.getParameters().get(0).evaluate(null));
}
@Test
public void testValidateValid() throws Exception {
List<Exception> exceptions = handler.validate("#000000\n#FFFFFF", null,null);
assertEquals(0, exceptions.size());
}
@Test
public void testValidateInvalid() throws Exception {
List<Exception> exceptions = handler.validate("abcde", null,null);
assertEquals(1, exceptions.size());
}
}