TILESSB-38
Fixed tiles-request-velocity code style.
git-svn-id: https://svn.apache.org/repos/asf/tiles/sandbox/trunk/tiles-request@1066512 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
index fceed29..b67ad7e 100644
--- a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/VelocityRequest.java
@@ -47,6 +47,9 @@
*/
public class VelocityRequest extends AbstractViewRequest {
+ /**
+ * The native available scopes, in fact only "page".
+ */
private static final String[] SCOPES = {"page"};
/**
@@ -64,8 +67,21 @@
*/
private Writer writer;
+ /**
+ * The map of the page scope.
+ */
private Map<String, Object> pageScope;
+ /**
+ * Factory method to create a Velocity request.
+ *
+ * @param applicationContext The application context.
+ * @param request The request.
+ * @param response The response.
+ * @param velocityContext The Velocity context.
+ * @param writer The writer to write into.
+ * @return The request.
+ */
public static VelocityRequest createVelocityRequest(
ApplicationContext applicationContext, HttpServletRequest request,
HttpServletResponse response, Context velocityContext, Writer writer) {
@@ -163,6 +179,11 @@
return requestObjects;
}
+ /**
+ * Returns the page scope.
+ *
+ * @return The page scope.
+ */
public Map<String, Object> getPageScope() {
if (pageScope == null) {
pageScope = new VelocityScopeMap(ctx);
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
index af12c9c..e81821d 100644
--- a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractor.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tiles.request.velocity.extractor;
import java.util.Enumeration;
@@ -5,10 +25,23 @@
import org.apache.tiles.request.attribute.AttributeExtractor;
import org.apache.velocity.context.Context;
+/**
+ * Extracts attributes from Velocity context..
+ *
+ * @version $Rev$ $Date$
+ */
public class VelocityScopeExtractor implements AttributeExtractor {
+ /**
+ * The Velocity context.
+ */
private Context context;
+ /**
+ * Constructor.
+ *
+ * @param context The Velocity context.
+ */
public VelocityScopeExtractor(Context context) {
this.context = context;
}
@@ -33,12 +66,26 @@
context.put(key, value);
}
+ /**
+ * Enumerates an array.
+ */
private static class KeyEnumeration implements Enumeration<String> {
+ /**
+ * The current index.
+ */
private int index = 0;
+ /**
+ * The array to enumerate.
+ */
private Object[] keys;
+ /**
+ * Constructor.
+ *
+ * @param keys The array to enumerate.
+ */
public KeyEnumeration(Object[] keys) {
this.keys = keys;
}
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
new file mode 100644
index 0000000..bed6df2
--- /dev/null
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/extractor/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Extractors to get info about Velocity-specific objects.
+ */
+package org.apache.tiles.request.velocity.extractor;
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
new file mode 100644
index 0000000..54b7c71
--- /dev/null
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Tiles request support for Velocity.
+ */
+package org.apache.tiles.request.velocity;
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
index 098cc28..905907f 100644
--- a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfig.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tiles.request.velocity.render;
import java.util.Enumeration;
@@ -30,6 +50,12 @@
*/
private Map<String, String> params;
+ /**
+ * Constructor.
+ *
+ * @param applicationContext The application context.
+ * @param params Configuration parameters.
+ */
public ApplicationContextJeeConfig(ApplicationContext applicationContext, Map<String, String> params) {
this.applicationContext = applicationContext;
this.params = new HashMap<String, String>(params);
@@ -60,4 +86,4 @@
public ServletContext getServletContext() {
return ServletUtil.getServletContext(applicationContext);
}
-}
\ No newline at end of file
+}
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
index 78e760a..bf92170 100644
--- a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRenderer.java
@@ -49,6 +49,11 @@
*/
private VelocityView velocityView;
+ /**
+ * Constructor.
+ *
+ * @param velocityView The Velocity view manager.
+ */
public VelocityRenderer(VelocityView velocityView) {
this.velocityView = velocityView;
}
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
index af8ecc8..b041af2 100644
--- a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/VelocityRendererBuilder.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tiles.request.velocity.render;
import java.util.HashMap;
@@ -7,7 +27,12 @@
import org.apache.tiles.request.ApplicationContext;
import org.apache.velocity.tools.view.VelocityView;
-public class VelocityRendererBuilder {
+/**
+ * Builds a {@link VelocityRenderer}.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class VelocityRendererBuilder {
/**
* The initialization parameters for VelocityView.
@@ -19,9 +44,17 @@
*/
private ApplicationContext applicationContext;
+ /**
+ * Constructor.
+ */
private VelocityRendererBuilder() {
}
+ /**
+ * Returns a new instance of the builder.
+ *
+ * @return A new builder.
+ */
public static VelocityRendererBuilder createInstance() {
return new VelocityRendererBuilder();
}
@@ -31,6 +64,7 @@
*
* @param key The name of the parameter.
* @param value The value of the parameter.
+ * @return This builder.
*/
public VelocityRendererBuilder setParameter(String key, String value) {
params.put(key, value);
@@ -41,12 +75,18 @@
* Sets the application context.
*
* @param applicationContext The application context.
+ * @return This builder.
*/
public VelocityRendererBuilder setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
return this;
}
+ /**
+ * Creates the Velocity renderer.
+ *
+ * @return The Velocity renderer.
+ */
public VelocityRenderer build() {
VelocityView velocityView = new VelocityView(
new ApplicationContextJeeConfig(applicationContext, params));
diff --git a/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
new file mode 100644
index 0000000..1b2877f
--- /dev/null
+++ b/tiles-request-velocity/src/main/java/org/apache/tiles/request/velocity/render/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * $Id: package-info.java 1049711 2010-12-15 21:12:00Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Renderering support for Velocity.
+ */
+package org.apache.tiles.request.velocity.render;
diff --git a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
index b82dcc4..f15041d 100644
--- a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
+++ b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityRequestTest.java
@@ -73,9 +73,7 @@
/**
* Tests {@link VelocityRequest
- * #createVelocityRequest(org.apache.tiles.request.ApplicationContext, HttpServletRequest, HttpServletResponse, Context, java.io.Writer)}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
+ * #createVelocityRequest(ApplicationContext, HttpServletRequest, HttpServletResponse, Context, Writer)}.
*/
@Test
public void testCreateVelocityRequest() {
@@ -84,7 +82,8 @@
ApplicationContext applicationContext = createMock(ApplicationContext.class);
replay(velocityContext, httpRequest, response, applicationContext);
- context = VelocityRequest.createVelocityRequest(applicationContext, httpRequest, response, velocityContext, writer);
+ context = VelocityRequest.createVelocityRequest(applicationContext,
+ httpRequest, response, velocityContext, writer);
ServletRequest servletRequest = (ServletRequest) context.getWrappedRequest();
assertEquals(httpRequest, servletRequest.getRequest());
assertEquals(response, servletRequest.getResponse());
@@ -134,9 +133,8 @@
* Tests {@link VelocityRequest#doInclude(String)}.
*
* @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testDoIncludeNoRequestDispatcher() throws IOException {
String path = "this way";
Request enclosedRequest = createMock(Request.class);
@@ -161,7 +159,7 @@
* @throws IOException If something goes wrong.
* @throws ServletException If something goes wrong.
*/
- @Test(expected=IOException.class)
+ @Test(expected = IOException.class)
public void testDoIncludeServletException() throws IOException, ServletException {
String path = "this way";
Request enclosedRequest = createMock(Request.class);
@@ -185,8 +183,6 @@
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetPrintWriter() {
@@ -200,8 +196,6 @@
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetPrintWriterPrintWriter() {
@@ -216,10 +210,8 @@
/**
* Tests {@link VelocityRequest#getPrintWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testGetPrintWriterNoWriter() {
Request enclosedRequest = createMock(Request.class);
@@ -231,8 +223,6 @@
/**
* Tests {@link VelocityRequest#getWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
@Test
public void testGetWriter() {
@@ -246,10 +236,8 @@
/**
* Tests {@link VelocityRequest#getWriter()}.
- *
- * @throws IOException If something goes wrong.
*/
- @Test(expected=IllegalStateException.class)
+ @Test(expected = IllegalStateException.class)
public void testGetWriterNoWriter() {
Request enclosedRequest = createMock(Request.class);
@@ -261,8 +249,6 @@
/**
* Tests {@link VelocityRequest#getRequestObjects()}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
@Test
public void testGetRequestObjects() {
@@ -284,8 +270,6 @@
/**
* Tests {@link VelocityRequest#getRequestObjects()}.
- * @throws IOException If something goes wrong.
- * @throws ServletException If something goes wrong.
*/
@Test
public void testGetRequestObjectsNoWriter() {
diff --git a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
index 4c6e4c4..4f64306 100644
--- a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
+++ b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/VelocityScopeMapTest.java
@@ -1,5 +1,22 @@
-/**
+/*
+ * $Id$
*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.tiles.request.velocity;
@@ -19,8 +36,14 @@
*/
public class VelocityScopeMapTest {
+ /**
+ * The Velocity context.
+ */
private Context request;
+ /**
+ * The map to test.
+ */
private VelocityScopeMap map;
/**
@@ -96,7 +119,7 @@
}
/**
- * Test method for {@link org.apache.tiles.request.velocity.VelocityScopeMap#put(java.lang.String, java.lang.Object)}.
+ * Test method for {@link VelocityScopeMap#put(String, Object)}.
*/
@Test
public void testPutStringObject() {
diff --git a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
index 0824635..4a86fe8 100644
--- a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
+++ b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/extractor/VelocityScopeExtractorTest.java
@@ -1,5 +1,22 @@
-/**
+/*
+ * $Id$
*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
package org.apache.tiles.request.velocity.extractor;
@@ -19,8 +36,14 @@
*/
public class VelocityScopeExtractorTest {
+ /**
+ * The Velocity context.
+ */
private Context request;
+ /**
+ * The extractor to test.
+ */
private VelocityScopeExtractor extractor;
/**
@@ -33,7 +56,7 @@
}
/**
- * Test method for {@link org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#removeValue(java.lang.String)}.
+ * Test method for {@link VelocityScopeExtractor#removeValue(java.lang.String)}.
*/
@Test
public void testRemoveValue() {
@@ -45,7 +68,7 @@
}
/**
- * Test method for {@link org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#getKeys()}.
+ * Test method for {@link VelocityScopeExtractor#getKeys()}.
*/
@Test
public void testGetKeys() {
@@ -62,7 +85,7 @@
}
/**
- * Test method for {@link org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#getValue(java.lang.String)}.
+ * Test method for {@link VelocityScopeExtractor#getValue(java.lang.String)}.
*/
@Test
public void testGetValue() {
@@ -74,7 +97,7 @@
}
/**
- * Test method for {@link org.apache.tiles.request.velocity.extractor.VelocityScopeExtractor#setValue(java.lang.String, java.lang.Object)}.
+ * Test method for {@link VelocityScopeExtractor#setValue(java.lang.String, java.lang.Object)}.
*/
@Test
public void testSetValue() {
diff --git a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
index 8bf3560..036e6e5 100644
--- a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
+++ b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/ApplicationContextJeeConfigTest.java
@@ -1,3 +1,23 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.tiles.request.velocity.render;
import static org.easymock.EasyMock.*;
@@ -14,27 +34,53 @@
import org.junit.Before;
import org.junit.Test;
+/**
+ * Tests {@link ApplicationContextJeeConfig}.
+ *
+ * @version $Rev$ $Date$
+ */
public class ApplicationContextJeeConfigTest {
+ /**
+ * The configuration to test.
+ */
private ApplicationContextJeeConfig config;
+ /**
+ * The application context.
+ */
private ServletApplicationContext applicationContext;
+ /**
+ * The servlet context.
+ */
private ServletContext servletContext;
+ /**
+ * Custom parameters.
+ */
private Map<String, String> params;
+ /**
+ * Sets up the test.
+ */
@Before
public void setUp() {
servletContext = createMock(ServletContext.class);
applicationContext = new ServletApplicationContext(servletContext);
}
+ /**
+ * Tears down the test.
+ */
@After
public void tearDown() {
verify(servletContext);
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getInitParameter(String)}.
+ */
@Test
public void testGetInitParameter() {
params = new HashMap<String, String>();
@@ -44,6 +90,9 @@
assertEquals("value1", config.getInitParameter("one"));
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#findInitParameter(String)}.
+ */
@Test
public void testFindInitParameter() {
params = new HashMap<String, String>();
@@ -53,6 +102,9 @@
assertEquals("value1", config.findInitParameter("one"));
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getInitParameterNames()}.
+ */
@Test
public void testGetInitParameterNames() {
params = new HashMap<String, String>();
@@ -66,6 +118,9 @@
assertFalse(names.hasMoreElements());
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getName()}.
+ */
@Test
public void testGetName() {
params = new HashMap<String, String>();
@@ -75,6 +130,9 @@
assertEquals("Application Context JEE Config", config.getName());
}
+ /**
+ * Tests {@link ApplicationContextJeeConfig#getServletContext()}.
+ */
@Test
public void testGetServletContext() {
params = new HashMap<String, String>();
diff --git a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
index 1b21e9e..c396636 100644
--- a/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
+++ b/tiles-request-velocity/src/test/java/org/apache/tiles/request/velocity/render/VelocityRendererTest.java
@@ -33,7 +33,6 @@
import org.apache.tiles.request.render.CannotRenderException;
import org.apache.tiles.request.render.TypeDetectingRenderer;
import org.apache.tiles.request.servlet.ServletRequest;
-import org.apache.tiles.request.velocity.render.VelocityRenderer;
import org.apache.velocity.Template;
import org.apache.velocity.tools.view.VelocityView;
import org.apache.velocity.tools.view.ViewToolContext;
@@ -77,7 +76,7 @@
* Tests {@link VelocityRenderer#render(String, org.apache.tiles.request.Request)}.
* @throws IOException If something goes wrong.
*/
- @Test(expected=CannotRenderException.class)
+ @Test(expected = CannotRenderException.class)
public void testRenderException() throws IOException {
VelocityView view = createMock(VelocityView.class);
ServletRequest request = createMock(ServletRequest.class);