#84 - master - reformat the code

This commit is contained in:
eblondel 2013-07-04 22:08:38 +02:00
parent 93ec8db2fb
commit 09299bf320
2 changed files with 46 additions and 34 deletions

View File

@ -137,7 +137,8 @@ public class GSLayerEncoder extends PropertyXMLEncoder {
/** /**
* Add a style * Add a style
* @param style to add to the list of available styles *
* @param style
*/ */
public void addStyle(String style) { public void addStyle(String style) {
final Element el = new Element("style"); final Element el = new Element("style");

View File

@ -19,7 +19,6 @@
*/ */
package it.geosolutions.geoserver.rest.encoder; package it.geosolutions.geoserver.rest.encoder;
import junit.framework.Assert; import junit.framework.Assert;
import org.jdom.Element; import org.jdom.Element;
@ -37,7 +36,7 @@ public class GSLayerEncoderTest {
GSLayerEncoder layerEncoder; GSLayerEncoder layerEncoder;
@Before @Before
public void setup(){ public void setup() {
layerEncoder = new GSLayerEncoder(); layerEncoder = new GSLayerEncoder();
layerEncoder.setEnabled(true); layerEncoder.setEnabled(true);
layerEncoder.setQueryable(true); layerEncoder.setQueryable(true);
@ -47,28 +46,40 @@ public class GSLayerEncoderTest {
} }
@Test @Test
public void testProperties(){ public void testProperties() {
Assert.assertEquals(true, Boolean.parseBoolean(layerEncoder.getRoot().getChild("enabled").getValue())); Assert.assertEquals(
Assert.assertEquals(true, Boolean.parseBoolean(layerEncoder.getRoot().getChild("queryable").getValue())); true,
Boolean.parseBoolean(layerEncoder.getRoot().getChild("enabled")
.getValue()));
Assert.assertEquals(
true,
Boolean.parseBoolean(layerEncoder.getRoot()
.getChild("queryable").getValue()));
} }
@Test @Test
public void testDefaultStyle(){ public void testDefaultStyle() {
Assert.assertEquals("point", layerEncoder.getRoot().getChild("defaultStyle").getValue()); Assert.assertEquals("point",
layerEncoder.getRoot().getChild("defaultStyle").getValue());
} }
@Test @Test
public void testMultipleStyles(){ public void testMultipleStyles() {
Assert.assertEquals(2, layerEncoder.getRoot().getChild("styles").getChildren().size()); Assert.assertEquals(2, layerEncoder.getRoot().getChild("styles")
Assert.assertEquals("additional_style1", ((Element) layerEncoder.getRoot().getChild("styles").getChildren().get(0)).getText()); .getChildren().size());
Assert.assertEquals("additional_style2", ((Element) layerEncoder.getRoot().getChild("styles").getChildren().get(1)).getText()); Assert.assertEquals("additional_style1", ((Element) layerEncoder
.getRoot().getChild("styles").getChildren().get(0)).getText());
Assert.assertEquals("additional_style2", ((Element) layerEncoder
.getRoot().getChild("styles").getChildren().get(1)).getText());
} }
@Test @Test
public void testRemoveStyle(){ public void testRemoveStyle() {
Assert.assertTrue(layerEncoder.delStyle("additional_style1")); Assert.assertTrue(layerEncoder.delStyle("additional_style1"));
Assert.assertEquals(1,layerEncoder.getRoot().getChild("styles").getChildren().size()); Assert.assertEquals(1, layerEncoder.getRoot().getChild("styles")
Assert.assertEquals("additional_style2", ((Element) layerEncoder.getRoot().getChild("styles").getChildren().get(0)).getText()); .getChildren().size());
Assert.assertEquals("additional_style2", ((Element) layerEncoder
.getRoot().getChild("styles").getChildren().get(0)).getText());
} }
} }