Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase test coverage in the ncwms module
- Loading branch information
Showing
3 changed files
with
46 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/community/ncwms/src/test/java/org/geoserver/wms/style/PaletteStyleHandlerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,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()); | |||
} | |||
|
|||
} |