You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/07/02 02:31:08 UTC
svn commit: r959818 [2/2] - in /myfaces/core/trunk: ./ api/
api/src/test/java/javax/faces/application/
api/src/test/java/javax/faces/convert/ impl/
impl/src/test/java/org/apache/myfaces/view/facelets/
impl/src/test/java/org/apache/myfaces/view/facelets...
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java Fri Jul 2 00:31:07 2010
@@ -36,6 +36,8 @@ import org.apache.myfaces.test.utils.Htm
import org.apache.myfaces.test.utils.HtmlRenderedAttr;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
+import org.junit.Assert;
+import org.junit.Test;
public class CompositeComponentTestCase extends FaceletTestCase
{
@@ -46,17 +48,18 @@ public class CompositeComponentTestCase
*
* @throws Exception
*/
+ @Test
public void testSimpleCompositeComponent() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleComposite.xhtml");
UIComponent panelGroup = root.findComponent("testGroup");
- assertNotNull(panelGroup);
+ Assert.assertNotNull(panelGroup);
UINamingContainer compositeComponent = (UINamingContainer) panelGroup.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UIOutput text = (UIOutput) compositeComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME).findComponent("text");
- assertNotNull(text);
+ Assert.assertNotNull(text);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -77,48 +80,49 @@ public class CompositeComponentTestCase
*
* @throws Exception
*/
+ @Test
public void testSimpleCompositeAttribute() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleAttribute.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
HtmlOutputText text1 = (HtmlOutputText) facet1.findComponent("text");
- assertNotNull(text1);
+ Assert.assertNotNull(text1);
compositeComponent1.pushComponentToEL(facesContext, compositeComponent1);
facet1.pushComponentToEL(facesContext, facet1);
text1.pushComponentToEL(facesContext, text1);
//set on tag
- assertEquals("class1", text1.getStyleClass());
+ Assert.assertEquals("class1", text1.getStyleClass());
//set as default
- assertEquals("background:red", text1.getStyle());
+ Assert.assertEquals("background:red", text1.getStyle());
text1.popComponentFromEL(facesContext);
facet1.popComponentFromEL(facesContext);
compositeComponent1.popComponentFromEL(facesContext);
UIComponent panelGroup2 = root.findComponent("testGroup2");
- assertNotNull(panelGroup2);
+ Assert.assertNotNull(panelGroup2);
UINamingContainer compositeComponent2 = (UINamingContainer) panelGroup2.getChildren().get(0);
- assertNotNull(compositeComponent2);
+ Assert.assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet2);
+ Assert.assertNotNull(facet2);
HtmlOutputText text2 = (HtmlOutputText) facet2.findComponent("text");
- assertNotNull(text2);
+ Assert.assertNotNull(text2);
compositeComponent2.pushComponentToEL(facesContext, compositeComponent2);
facet2.pushComponentToEL(facesContext, facet2);
text2.pushComponentToEL(facesContext, text2);
//set on tag
- assertEquals("background:green", text2.getStyle());
+ Assert.assertEquals("background:green", text2.getStyle());
// not set, should return null, but since there is a ValueExpression indirection,
// coercing rules apply here, so null is converted as ""
- assertEquals("", text2.getStyleClass());
+ Assert.assertEquals("", text2.getStyleClass());
text2.popComponentFromEL(facesContext);
facet2.popComponentFromEL(facesContext);
compositeComponent2.popComponentFromEL(facesContext);
@@ -137,6 +141,7 @@ public class CompositeComponentTestCase
HtmlCheckAttributesUtil.checkRenderedAttributes(attrs, sw.toString());
}
+ @Test
public void testSimpleCompositeAttributeMethodExpression() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -148,22 +153,22 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleAttributeMethodExpression.xhtml");
UIComponent form = root.findComponent("testForm1");
- assertNotNull(form);
+ Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- assertNotNull(button);
- assertEquals("#{helloWorldBean.send}", button.getActionExpression().getExpressionString());
- assertEquals("#{helloWorldBean.send}", ((MethodExpression)compositeComponent.getAttributes().get("metodo")).getExpressionString());
- assertNull(button.getAttributes().get("metodo"));
+ Assert.assertNotNull(button);
+ Assert.assertEquals("#{helloWorldBean.send}", button.getActionExpression().getExpressionString());
+ Assert.assertEquals("#{helloWorldBean.send}", ((MethodExpression)compositeComponent.getAttributes().get("metodo")).getExpressionString());
+ Assert.assertNull(button.getAttributes().get("metodo"));
UICommand link = (UICommand) compositeComponent.findComponent("link");
- assertNotNull(link);
- assertEquals(1, link.getActionListeners().length);
+ Assert.assertNotNull(link);
+ Assert.assertEquals(1, link.getActionListeners().length);
UIInput input = (UIInput) compositeComponent.findComponent("input");
- assertNotNull(input);
- assertEquals(1, input.getValidators().length);
- assertEquals(1, input.getValueChangeListeners().length);
+ Assert.assertNotNull(input);
+ Assert.assertEquals(1, input.getValidators().length);
+ Assert.assertEquals(1, input.getValueChangeListeners().length);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -175,6 +180,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleActionSource() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -186,12 +192,12 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleActionSource.xhtml");
UIComponent form = root.findComponent("testForm1");
- assertNotNull(form);
+ Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
- assertNotNull(button);
- assertEquals(3, button.getActionListeners().length);
+ Assert.assertNotNull(button);
+ Assert.assertEquals(3, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -202,6 +208,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleValueHolder() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -213,13 +220,13 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleValueHolder.xhtml");
UIComponent form = root.findComponent("testForm1");
- assertNotNull(form);
+ Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UIOutput text = (UIOutput) compositeComponent.findComponent("text");
- assertNotNull(text);
- assertNotNull(text.getConverter());
- //assertEquals(2, button.getActionListeners().length);
+ Assert.assertNotNull(text);
+ Assert.assertNotNull(text.getConverter());
+ //Assert.assertEquals(2, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -230,6 +237,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testCompositeActionSource() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -241,16 +249,16 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeActionSource.xhtml");
UIComponent form = root.findComponent("testForm1");
- assertNotNull(form);
+ Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button3");
- assertNotNull(compositeComponent2);
+ Assert.assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button");
- assertNotNull(button);
+ Assert.assertNotNull(button);
//One added in testCompositeActionSource, the other one
//inside compositeActionSource.xhtml
- assertEquals(2, button.getActionListeners().length);
+ Assert.assertEquals(2, button.getActionListeners().length);
//StringWriter sw = new StringWriter();
//MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -261,6 +269,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleInsertChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -273,13 +282,13 @@ public class CompositeComponentTestCase
/*
UIComponent form = root.findComponent("testForm1");
- assertNotNull(form);
+ Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
- assertNotNull(compositeComponent);
+ Assert.assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button3");
- assertNotNull(compositeComponent2);
+ Assert.assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button");
- assertNotNull(button);
+ Assert.assertNotNull(button);
*/
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -290,14 +299,15 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("Hello"));
- assertTrue(resp.contains("Leonardo"));
- assertTrue(resp.contains("Alfredo"));
- assertTrue(resp.contains("Uribe"));
- assertTrue(resp.contains("Sayonara"));
+ Assert.assertTrue(resp.contains("Hello"));
+ Assert.assertTrue(resp.contains("Leonardo"));
+ Assert.assertTrue(resp.contains("Alfredo"));
+ Assert.assertTrue(resp.contains("Uribe"));
+ Assert.assertTrue(resp.contains("Sayonara"));
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleInsertChildrenAjax() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -309,15 +319,15 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleInsertChildrenAjax.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) facet1.findComponent("link");
- assertNotNull(link);
- assertEquals(1, link.getClientBehaviors().size());
- assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
+ Assert.assertNotNull(link);
+ Assert.assertEquals(1, link.getClientBehaviors().size());
+ Assert.assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -331,6 +341,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleInsertChildrenAjax2() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -342,15 +353,15 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleInsertChildrenAjax2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) compositeComponent1.findComponent("link");
- assertNotNull(link);
- assertEquals(1, link.getClientBehaviors().size());
- assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
+ Assert.assertNotNull(link);
+ Assert.assertEquals(1, link.getClientBehaviors().size());
+ Assert.assertEquals(1, link.getClientBehaviors().get(link.getDefaultEventName()).size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -364,6 +375,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleInsertChildrenNoAjax() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -375,14 +387,14 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleInsertChildrenNoAjax.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
HtmlCommandLink link = (HtmlCommandLink) facet1.findComponent("link");
- assertNotNull(link);
- assertEquals(0, link.getClientBehaviors().size());
+ Assert.assertNotNull(link);
+ Assert.assertEquals(0, link.getClientBehaviors().size());
/*
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -396,6 +408,7 @@ public class CompositeComponentTestCase
//System.out.print(sw.toString());
}
+ @Test
public void testCompositeInsertChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -407,11 +420,11 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertChildren.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -423,12 +436,13 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("ALFA"));
- assertTrue(resp.contains("BETA"));
- assertTrue(resp.contains("GAMMA"));
- assertTrue(resp.contains("OMEGA"));
+ Assert.assertTrue(resp.contains("ALFA"));
+ Assert.assertTrue(resp.contains("BETA"));
+ Assert.assertTrue(resp.contains("GAMMA"));
+ Assert.assertTrue(resp.contains("OMEGA"));
}
+ @Test
public void testCompositeInsertChildrenPreserveTemplateSlot() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -440,11 +454,11 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertChildren2.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -456,12 +470,13 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("ALFA"));
- assertTrue(resp.contains("BETA"));
- assertTrue(resp.contains("GAMMA"));
- assertTrue(resp.contains("OMEGA"));
+ Assert.assertTrue(resp.contains("ALFA"));
+ Assert.assertTrue(resp.contains("BETA"));
+ Assert.assertTrue(resp.contains("GAMMA"));
+ Assert.assertTrue(resp.contains("OMEGA"));
}
+ @Test
public void testCompositeInsertChildren3() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -473,11 +488,11 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertChildren3.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -489,12 +504,13 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("ALFA"));
- assertTrue(resp.contains("BETA"));
- assertTrue(resp.contains("GAMMA"));
- assertTrue(resp.contains("OMEGA"));
+ Assert.assertTrue(resp.contains("ALFA"));
+ Assert.assertTrue(resp.contains("BETA"));
+ Assert.assertTrue(resp.contains("GAMMA"));
+ Assert.assertTrue(resp.contains("OMEGA"));
}
+ @Test
public void testCompositeInsertChildren4() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -506,11 +522,11 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertChildren4.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
//UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- //assertNotNull(compositeComponent1);
+ //Assert.assertNotNull(compositeComponent1);
//UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- //assertNotNull(facet1);
+ //Assert.assertNotNull(facet1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -522,12 +538,13 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("ALFA"));
- assertTrue(resp.contains("BETA"));
- assertTrue(resp.contains("GAMMA"));
- assertTrue(resp.contains("OMEGA"));
+ Assert.assertTrue(resp.contains("ALFA"));
+ Assert.assertTrue(resp.contains("BETA"));
+ Assert.assertTrue(resp.contains("GAMMA"));
+ Assert.assertTrue(resp.contains("OMEGA"));
}
+ @Test
public void testCompositeInsertFacet() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -539,22 +556,23 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertFacet.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- assertNotNull(compositeComponent2);
+ Assert.assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet2);
- assertEquals(1,facet2.getChildCount());
+ Assert.assertNotNull(facet2);
+ Assert.assertEquals(1,facet2.getChildCount());
UIOutput targetComp = (UIOutput) facet2.getChildren().get(0);
UIComponent insertedFacet = targetComp.getFacet("header");
- assertNotNull(insertedFacet);
+ Assert.assertNotNull(insertedFacet);
}
+ @Test
public void testCompositeInsertFacetChildren() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -566,21 +584,22 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testCompositeInsertFacetChildren.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
UIComponent facet1 = compositeComponent1.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet1);
+ Assert.assertNotNull(facet1);
UINamingContainer compositeComponent2 = (UINamingContainer) facet1.getChildren().get(0);
- assertNotNull(compositeComponent2);
+ Assert.assertNotNull(compositeComponent2);
UIComponent facet2 = compositeComponent2.getFacet(UIComponent.COMPOSITE_FACET_NAME);
- assertNotNull(facet2);
- assertEquals(3,facet2.getChildCount());
+ Assert.assertNotNull(facet2);
+ Assert.assertEquals(3,facet2.getChildCount());
UIComponent insertedFacet = facet2.getChildren().get(1).getFacet("header");
- assertNotNull(insertedFacet);
+ Assert.assertNotNull(insertedFacet);
}
+ @Test
public void testSimpleRenderFacet() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -592,9 +611,9 @@ public class CompositeComponentTestCase
vdl.buildView(facesContext, root, "testSimpleRenderFacet.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
- assertNotNull(panelGroup1);
+ Assert.assertNotNull(panelGroup1);
UINamingContainer compositeComponent1 = (UINamingContainer) panelGroup1.getChildren().get(0);
- assertNotNull(compositeComponent1);
+ Assert.assertNotNull(compositeComponent1);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -606,8 +625,8 @@ public class CompositeComponentTestCase
String resp = sw.toString();
- assertTrue(resp.contains("HELLO"));
- assertTrue(resp.contains("WORLD"));
+ Assert.assertTrue(resp.contains("HELLO"));
+ Assert.assertTrue(resp.contains("WORLD"));
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/CoreTestCase.java Fri Jul 2 00:31:07 2010
@@ -53,6 +53,8 @@ import org.apache.myfaces.renderkit.html
import org.apache.myfaces.renderkit.html.HtmlTableRenderer;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
public class CoreTestCase extends FaceletTestCase
{
@@ -110,6 +112,7 @@ public class CoreTestCase extends Facele
new HtmlTableRenderer());
}
+ @Test
public void testActionListenerHandler() throws Exception
{
ActionListener listener = new ActionListenerImpl();
@@ -123,18 +126,19 @@ public class CoreTestCase extends Facele
UICommand action1 = (UICommand) root.findComponent("action1");
UICommand action2 = (UICommand) root.findComponent("action2");
- assertNotNull("action1", action1);
- assertNotNull("action2", action2);
+ Assert.assertNotNull("action1", action1);
+ Assert.assertNotNull("action2", action2);
- assertEquals("action1 listeners", 1,
+ Assert.assertEquals("action1 listeners", 1,
action1.getActionListeners().length);
- assertEquals("action2 listeners", 2,
+ Assert.assertEquals("action2 listeners", 2,
action2.getActionListeners().length);
- //assertEquals("action2 binding", listener,
+ //Assert.assertEquals("action2 binding", listener,
// action2.getActionListeners()[0]);
}
+ @Test
public void testAttributeHandler() throws Exception
{
String title = "Dog in a Funny Hat";
@@ -148,13 +152,14 @@ public class CoreTestCase extends Facele
HtmlGraphicImage graphic2 = (HtmlGraphicImage) root
.findComponent("graphic2");
- assertNotNull("graphic1", graphic1);
- assertNotNull("graphic2", graphic2);
+ Assert.assertNotNull("graphic1", graphic1);
+ Assert.assertNotNull("graphic2", graphic2);
- assertEquals("graphic1 title", "literal", graphic1.getTitle());
- assertEquals("graphic2 title", title, graphic2.getTitle());
+ Assert.assertEquals("graphic1 title", "literal", graphic1.getTitle());
+ Assert.assertEquals("graphic2 title", title, graphic2.getTitle());
}
+ @Test
public void testConvertDateTimeHandler() throws Exception
{
Date now = new Date(1000 * 360 * 60 * 24 * 7);
@@ -170,34 +175,35 @@ public class CoreTestCase extends Facele
UIOutput out5 = (UIOutput) root.findComponent("form:out5");
UIOutput out6 = (UIOutput) root.findComponent("form:out6");
- assertNotNull("out1", out1);
- assertNotNull("out2", out2);
- assertNotNull("out3", out3);
- assertNotNull("out4", out4);
- assertNotNull("out5", out5);
- assertNotNull("out6", out6);
-
- assertNotNull("out1 converter", out1.getConverter());
- assertNotNull("out2 converter", out2.getConverter());
- assertNotNull("out3 converter", out3.getConverter());
- assertNotNull("out4 converter", out4.getConverter());
- assertNotNull("out5 converter", out5.getConverter());
+ Assert.assertNotNull("out1", out1);
+ Assert.assertNotNull("out2", out2);
+ Assert.assertNotNull("out3", out3);
+ Assert.assertNotNull("out4", out4);
+ Assert.assertNotNull("out5", out5);
+ Assert.assertNotNull("out6", out6);
+
+ Assert.assertNotNull("out1 converter", out1.getConverter());
+ Assert.assertNotNull("out2 converter", out2.getConverter());
+ Assert.assertNotNull("out3 converter", out3.getConverter());
+ Assert.assertNotNull("out4 converter", out4.getConverter());
+ Assert.assertNotNull("out5 converter", out5.getConverter());
DateTimeConverter converter6 = (DateTimeConverter) out6.getConverter();
- assertEquals("out1 value", "12/24/69", out1.getConverter().getAsString(
+ Assert.assertEquals("out1 value", "12/24/69", out1.getConverter().getAsString(
facesContext, out1, now));
- assertEquals("out2 value", "12/24/69 6:57:12 AM", out2.getConverter()
+ Assert.assertEquals("out2 value", "12/24/69 6:57:12 AM", out2.getConverter()
.getAsString(facesContext, out2, now));
- assertEquals("out3 value", "Dec 24, 1969", out3.getConverter()
+ Assert.assertEquals("out3 value", "Dec 24, 1969", out3.getConverter()
.getAsString(facesContext, out3, now));
- assertEquals("out4 value", "6:57:12 AM", out4.getConverter()
+ Assert.assertEquals("out4 value", "6:57:12 AM", out4.getConverter()
.getAsString(facesContext, out4, now));
- assertEquals("out5 value", "0:57 AM, CST", out5.getConverter()
+ Assert.assertEquals("out5 value", "0:57 AM, CST", out5.getConverter()
.getAsString(facesContext, out5, now));
- assertEquals("Timezone should be GMT", TimeZone.getTimeZone("GMT"),
+ Assert.assertEquals("Timezone should be GMT", TimeZone.getTimeZone("GMT"),
converter6.getTimeZone());
}
+ @Test
public void testConvertDelegateHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -206,14 +212,15 @@ public class CoreTestCase extends Facele
UIOutput out1 = (UIOutput) root.findComponent("out1");
- assertNotNull("out1", out1);
+ Assert.assertNotNull("out1", out1);
- assertNotNull("out1 converter", out1.getConverter());
+ Assert.assertNotNull("out1 converter", out1.getConverter());
- assertEquals("out1 value", new Double(42.5), out1.getConverter()
+ Assert.assertEquals("out1 value", new Double(42.5), out1.getConverter()
.getAsObject(facesContext, out1, out1.getLocalValue().toString()));
}
+ @Test
public void testConvertNumberHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -226,30 +233,31 @@ public class CoreTestCase extends Facele
UIOutput out4 = (UIOutput) root.findComponent("out4");
UIOutput out5 = (UIOutput) root.findComponent("out5");
- assertNotNull("out1", out1);
- assertNotNull("out2", out2);
- assertNotNull("out3", out3);
- assertNotNull("out4", out4);
- assertNotNull("out5", out5);
-
- assertNotNull("out1 converter", out1.getConverter());
- assertNotNull("out2 converter", out2.getConverter());
- assertNotNull("out3 converter", out3.getConverter());
- assertNotNull("out4 converter", out4.getConverter());
- assertNotNull("out5 converter", out5.getConverter());
+ Assert.assertNotNull("out1", out1);
+ Assert.assertNotNull("out2", out2);
+ Assert.assertNotNull("out3", out3);
+ Assert.assertNotNull("out4", out4);
+ Assert.assertNotNull("out5", out5);
+
+ Assert.assertNotNull("out1 converter", out1.getConverter());
+ Assert.assertNotNull("out2 converter", out2.getConverter());
+ Assert.assertNotNull("out3 converter", out3.getConverter());
+ Assert.assertNotNull("out4 converter", out4.getConverter());
+ Assert.assertNotNull("out5 converter", out5.getConverter());
- assertEquals("out1 value", "12", out1.getConverter().getAsString(facesContext,
+ Assert.assertEquals("out1 value", "12", out1.getConverter().getAsString(facesContext,
out1, new Double(12.001)));
- assertEquals("out2 value", "$12.00", out2.getConverter().getAsString(
+ Assert.assertEquals("out2 value", "$12.00", out2.getConverter().getAsString(
facesContext, out2, new Double(12.00)));
- assertEquals("out3 value", "00,032", out3.getConverter().getAsString(
+ Assert.assertEquals("out3 value", "00,032", out3.getConverter().getAsString(
facesContext, out3, new Double(32)));
- assertEquals("out4 value", "0.67", out4.getConverter().getAsString(
+ Assert.assertEquals("out4 value", "0.67", out4.getConverter().getAsString(
facesContext, out4, new Double(2.0 / 3.0)));
- assertEquals("out5 value", "67%", out5.getConverter().getAsString(
+ Assert.assertEquals("out5 value", "67%", out5.getConverter().getAsString(
facesContext, out5, new Double(0.67)));
}
+ @Test
public void testFacetHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -257,13 +265,14 @@ public class CoreTestCase extends Facele
UIData data = (UIData) root.findComponent("table");
- assertNotNull("data", data);
+ Assert.assertNotNull("data", data);
UIComponent footer = data.getFooter();
- assertNotNull("footer", footer);
+ Assert.assertNotNull("footer", footer);
}
+ @Test
public void testLoadBundleHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -271,12 +280,13 @@ public class CoreTestCase extends Facele
Object value = facesContext.getExternalContext().getRequestMap().get("foo");
- assertNotNull("bundle loaded into request", value);
- assertTrue(value instanceof Map);
+ Assert.assertNotNull("bundle loaded into request", value);
+ Assert.assertTrue(value instanceof Map);
String result = (String) ((Map) value).get("some.not.found.key");
- assertTrue(result.contains("???"));
+ Assert.assertTrue(result.contains("???"));
}
+ @Test
public void testValidateDelegateHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -284,15 +294,16 @@ public class CoreTestCase extends Facele
UIInput input = (UIInput) root.findComponent("form:input");
- assertNotNull("input", input);
+ Assert.assertNotNull("input", input);
- assertEquals("input validator", 1, input.getValidators().length);
+ Assert.assertEquals("input validator", 1, input.getValidators().length);
Validator v = input.getValidators()[0];
v.validate(facesContext, input, "4333");
}
+ @Test
public void testValidateDoubleRangeHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -300,15 +311,16 @@ public class CoreTestCase extends Facele
UIInput input = (UIInput) root.findComponent("form:input");
- assertNotNull("input", input);
+ Assert.assertNotNull("input", input);
- assertEquals("input validator", 1, input.getValidators().length);
+ Assert.assertEquals("input validator", 1, input.getValidators().length);
Validator v = input.getValidators()[0];
v.validate(facesContext, input, new Double(1.8));
}
+ @Test
public void testValidateLengthHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -316,15 +328,16 @@ public class CoreTestCase extends Facele
UIInput input = (UIInput) root.findComponent("form:input");
- assertNotNull("input", input);
+ Assert.assertNotNull("input", input);
- assertEquals("input validator", 1, input.getValidators().length);
+ Assert.assertEquals("input validator", 1, input.getValidators().length);
Validator v = input.getValidators()[0];
v.validate(facesContext, input, "beans");
}
+ @Test
public void testValidateLongRangeHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -332,15 +345,16 @@ public class CoreTestCase extends Facele
UIInput input = (UIInput) root.findComponent("form:input");
- assertNotNull("input", input);
+ Assert.assertNotNull("input", input);
- assertEquals("input validator", 1, input.getValidators().length);
+ Assert.assertEquals("input validator", 1, input.getValidators().length);
Validator v = input.getValidators()[0];
v.validate(facesContext, input, new Long(2000));
}
+ @Test
public void testValueChangeListenerHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -348,18 +362,19 @@ public class CoreTestCase extends Facele
UIInput input = (UIInput) root.findComponent("form:input");
- assertNotNull("input", input);
+ Assert.assertNotNull("input", input);
- assertEquals("input listener", 1,
+ Assert.assertEquals("input listener", 1,
input.getValueChangeListeners().length);
}
+ @Test
public void testViewHandler() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "view.xml");
- assertEquals("german locale", Locale.GERMAN, root.getLocale());
+ Assert.assertEquals("german locale", Locale.GERMAN, root.getLocale());
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateBeanTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateBeanTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateBeanTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ValidateBeanTestCase.java Fri Jul 2 00:31:07 2010
@@ -28,6 +28,8 @@ import javax.faces.validator.Validator;
import org.apache.myfaces.util.ExternalSpecifications;
import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Tests for <f:validateBean />.
@@ -39,7 +41,7 @@ public class ValidateBeanTestCase extend
{
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
@@ -122,6 +124,7 @@ public class ValidateBeanTestCase extend
* In this case the BeanValidator has to be installed.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testBeanValidatorInstalledManually() throws IOException
{
@@ -136,7 +139,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- assertTrue(_hasValidator(input, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(input, BeanValidator.class));
}
/**
@@ -145,6 +148,7 @@ public class ValidateBeanTestCase extend
* In this case the BeanValidator has to be installed.
* @throws IOException
*/
+ @Test
public void testBeanValidatorInstalledAutomatically() throws IOException
{
// add the BeanValidator as default-validator
@@ -158,7 +162,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- assertTrue(_hasValidator(input, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(input, BeanValidator.class));
}
/**
@@ -167,6 +171,7 @@ public class ValidateBeanTestCase extend
* In this case the BeanValidator must not be installed.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testDisabledBeanValidatorNotInstalled() throws IOException
{
@@ -184,7 +189,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput must not have the BeanValidator installed
- assertFalse(_hasValidator(input, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(input, BeanValidator.class));
}
/**
@@ -195,6 +200,7 @@ public class ValidateBeanTestCase extend
* on any other EditableValueHolder on the facelet.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testNestingValidateBean() throws IOException
{
@@ -212,10 +218,10 @@ public class ValidateBeanTestCase extend
UIInput nonnestedinput = (UIInput) root.findComponent("form:nonnestedinput");
// all wrapped UIInputs have to have the BeanValidator installed
- assertTrue(_hasValidator(nestedinput, BeanValidator.class));
- assertTrue(_hasValidator(doublenestedinput, BeanValidator.class));
- assertTrue(_hasValidator(nestedinput2, BeanValidator.class));
- assertFalse(_hasValidator(nonnestedinput, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(nestedinput, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(doublenestedinput, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(nestedinput2, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(nonnestedinput, BeanValidator.class));
}
/**
@@ -226,6 +232,7 @@ public class ValidateBeanTestCase extend
* on all nested EditableValueHolders on the facelet.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testNestingValidateBeanDisabled() throws IOException
{
@@ -246,10 +253,10 @@ public class ValidateBeanTestCase extend
UIInput nonnestedinput = (UIInput) root.findComponent("form:nonnestedinput");
// all wrapped UIInputs have to have the BeanValidator installed
- assertFalse(_hasValidator(nestedinput, BeanValidator.class));
- assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
- assertFalse(_hasValidator(nestedinput2, BeanValidator.class));
- assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(nestedinput, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(doublenestedinput, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(nestedinput2, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
}
/**
@@ -260,6 +267,7 @@ public class ValidateBeanTestCase extend
* In this case the BeanValidator has to be installed (see also MYFACES-2731).
* @throws IOException
*/
+ @Test
public void testValidateBeanDisabledAndEnabled() throws IOException
{
// build testValidateBeanDisabledAndEnabled.xhtml
@@ -270,7 +278,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the UIInput has to have the BeanValidator installed
- assertTrue(_hasValidator(input, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(input, BeanValidator.class));
}
/**
@@ -282,6 +290,7 @@ public class ValidateBeanTestCase extend
* itself should have the BeanValidator installed.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testValidateBeanNestingAndNested() throws IOException
{
@@ -302,15 +311,16 @@ public class ValidateBeanTestCase extend
// no wrapped UIInput has to have the BeanValidator installed,
// except the one nesting <f:validateBean /> itself.
- assertFalse(_hasValidator(nestedinput, BeanValidator.class));
- assertTrue(_hasValidator(nestedinputWithValidator, BeanValidator.class));
- assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(nestedinput, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(nestedinputWithValidator, BeanValidator.class));
+ Assert.assertTrue(_hasValidator(nonnestedinput, BeanValidator.class));
}
/**
* Tests if the validationGroups are set correctly.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testValidateBeanValidationGroups() throws IOException
{
@@ -328,7 +338,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the validationGroups have to match
- assertEquals(validationGroups, _getValidationGroups(input));
+ Assert.assertEquals(validationGroups, _getValidationGroups(input));
}
/**
@@ -337,6 +347,7 @@ public class ValidateBeanTestCase extend
* In this case the Default validation group has to be set on the BeanValidator.
* @throws IOException
*/
+ @Test
public void testValidateBeanDefaultValidationGroup() throws IOException
{
// add the BeanValidator as default-validator
@@ -350,7 +361,7 @@ public class ValidateBeanTestCase extend
UIInput input = (UIInput) root.findComponent("form:input");
// the validationGroups have to match the Default ones
- assertEquals(javax.validation.groups.Default.class.getName(),
+ Assert.assertEquals(javax.validation.groups.Default.class.getName(),
_getValidationGroups(input));
}
@@ -362,6 +373,7 @@ public class ValidateBeanTestCase extend
* Default validation group.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testValidateBeanValidationGroupsNested() throws IOException
{
@@ -386,10 +398,10 @@ public class ValidateBeanTestCase extend
// the validationGroups in the wrapped components have to match
// org.apache.myfaces.beanvalidation.Group1 and the non-nested ones
// have to match the Default group.
- assertEquals(validationGroups, _getValidationGroups(nestedinput));
- assertEquals(validationGroups, _getValidationGroups(doublenestedinput));
- assertEquals(validationGroups, _getValidationGroups(nestedinput2));
- assertEquals(javax.validation.groups.Default.class.getName(),
+ Assert.assertEquals(validationGroups, _getValidationGroups(nestedinput));
+ Assert.assertEquals(validationGroups, _getValidationGroups(doublenestedinput));
+ Assert.assertEquals(validationGroups, _getValidationGroups(nestedinput2));
+ Assert.assertEquals(javax.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
@@ -401,6 +413,7 @@ public class ValidateBeanTestCase extend
* validator and the non-nested component must get the Default validationGroups.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testValidateBeanValidationGroupsNestingAndNested() throws IOException
{
@@ -429,9 +442,9 @@ public class ValidateBeanTestCase extend
// the nested component without a validator must get the wrapping validationGroups,
// the nested component with the validator must get the validationGroups from the
// validator and the non-nested component must get the Default validationGroups.
- assertEquals(wrappingValidationGroups, _getValidationGroups(nestedinput));
- assertEquals(componentValidationGroups, _getValidationGroups(nestedinputWithValidator));
- assertEquals(javax.validation.groups.Default.class.getName(),
+ Assert.assertEquals(wrappingValidationGroups, _getValidationGroups(nestedinput));
+ Assert.assertEquals(componentValidationGroups, _getValidationGroups(nestedinputWithValidator));
+ Assert.assertEquals(javax.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
@@ -443,6 +456,7 @@ public class ValidateBeanTestCase extend
* and the non-nested component must get the Default validationGroups.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testValidateBeanValidationGroupsDoubleNesting() throws IOException
{
@@ -468,9 +482,9 @@ public class ValidateBeanTestCase extend
// the nested component must get the outer wrapping validationGroups,
// the double-nested component must get the inner wrapping validationGroups
// and the non-nested component must get the Default validationGroups.
- assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
- assertEquals(validationGroupsInner, _getValidationGroups(doublenestedinput));
- assertEquals(javax.validation.groups.Default.class.getName(),
+ Assert.assertEquals(validationGroupsOuter, _getValidationGroups(nestedinput));
+ Assert.assertEquals(validationGroupsInner, _getValidationGroups(doublenestedinput));
+ Assert.assertEquals(javax.validation.groups.Default.class.getName(),
_getValidationGroups(nonnestedinput));
}
@@ -481,6 +495,7 @@ public class ValidateBeanTestCase extend
* provides a log message for this scenario.
* @throws IOException
*/
+ @Test
public void testValidateBeanWithBeanValidationNotAvailable() throws IOException
{
// add the BeanValidator as default-validator
@@ -498,7 +513,7 @@ public class ValidateBeanTestCase extend
// the UIInput must not have the BeanValidator installed,
// because bean validation is not available
- assertFalse(_hasValidator(input, BeanValidator.class));
+ Assert.assertFalse(_hasValidator(input, BeanValidator.class));
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataTestCase.java Fri Jul 2 00:31:07 2010
@@ -33,9 +33,13 @@ import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.faces.view.ViewMetadata;
+import org.apache.myfaces.application.ViewHandlerImpl;
+import org.apache.myfaces.shared_impl.application.ViewHandlerSupport;
import org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImpl;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.bean.HelloWorld;
+import org.junit.Assert;
+import org.junit.Test;
public class ViewMetadataTestCase extends FaceletTestCase
{
@@ -88,7 +92,7 @@ public class ViewMetadataTestCase extend
}
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
navigationHandler = new MockViewNavigationHandlerNavigationHandler();
@@ -96,12 +100,13 @@ public class ViewMetadataTestCase extend
}
@Override
- protected void tearDown() throws Exception
+ public void tearDown() throws Exception
{
super.tearDown();
navigationHandler = null;
}
-
+
+ @Test
public void testSimpleViewMetadata() throws Exception
{
HelloWorld helloWorld = new HelloWorld();
@@ -121,7 +126,7 @@ public class ViewMetadataTestCase extend
Collection<UIViewParameter> viewParameters = metadata.getViewParameters(root);
- assertEquals(1, viewParameters.size());
+ Assert.assertEquals(1, viewParameters.size());
//root.setViewId("viewMetadata.xhtml");
vdl.buildView(facesContext, root, "viewMetadata.xhtml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/DataTableTestCase.java Fri Jul 2 00:31:07 2010
@@ -34,6 +34,7 @@ import org.apache.myfaces.renderkit.html
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.bean.Example;
import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.junit.Test;
public class DataTableTestCase extends FaceletTestCase
{
@@ -69,6 +70,7 @@ public class DataTableTestCase extends F
"javax.faces.Table", new HtmlTableRenderer());
}
+ @Test
public void testDataTable() throws Exception
{
facesContext.getExternalContext().getRequestMap().put("company",
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputLabelTestCase.java Fri Jul 2 00:31:07 2010
@@ -21,36 +21,30 @@ package org.apache.myfaces.view.facelets
import java.io.StringWriter;
-import javax.el.MethodExpression;
-import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UINamingContainer;
import javax.faces.component.UIOutput;
-import javax.faces.component.UISelectItem;
import javax.faces.component.UIViewRoot;
-import javax.faces.component.html.HtmlOutputText;
-import org.apache.myfaces.test.utils.HtmlCheckAttributesUtil;
-import org.apache.myfaces.test.utils.HtmlRenderedAttr;
-import org.apache.myfaces.view.facelets.FaceletTestCase;
-import org.apache.myfaces.view.facelets.bean.HelloWorld;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
public class HtmlOutputLabelTestCase extends FaceletTestCase
{
+ @Test
public void testOutputLabelEscape() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testOutputLabelEscape.xhtml");
UIComponent panelGroup = root.findComponent("testGroup1");
- assertNotNull(panelGroup);
+ Assert.assertNotNull(panelGroup);
UIOutput label = (UIOutput) panelGroup.findComponent("testLabel");
- assertNotNull(label);
+ Assert.assertNotNull(label);
UIOutput text = (UIOutput) panelGroup.findComponent("testOut");
- assertNotNull(text);
+ Assert.assertNotNull(text);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlOutputScriptTestCase.java Fri Jul 2 00:31:07 2010
@@ -21,24 +21,25 @@ package org.apache.myfaces.view.facelets
import java.io.StringWriter;
import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
-import javax.faces.component.UIOutput;
import javax.faces.component.UIViewRoot;
-import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
public class HtmlOutputScriptTestCase extends FaceletTestCase
{
+ @Test
public void testSimpleOutputScript() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleOutputScript.xhtml");
UIComponent head = root.findComponent("head");
- assertNotNull(head);
+ Assert.assertNotNull(head);
UIComponent body = root.findComponent("body");
- assertNotNull(body);
+ Assert.assertNotNull(body);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -49,15 +50,16 @@ public class HtmlOutputScriptTestCase ex
//System.out.print(sw.toString());
}
+ @Test
public void testSimpleTargetHeadOutputScript() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleTargetHeadOutputScript.xhtml");
UIComponent head = root.findComponent("head");
- assertNotNull(head);
+ Assert.assertNotNull(head);
UIComponent body = root.findComponent("body");
- assertNotNull(body);
+ Assert.assertNotNull(body);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
@@ -68,15 +70,16 @@ public class HtmlOutputScriptTestCase ex
//System.out.print(sw.toString());
}
+ @Test
public void testMultipleTargetHeadOutputScript() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testMultipleTargetHeadOutputScript.xhtml");
UIComponent head = root.findComponent("head");
- assertNotNull(head);
+ Assert.assertNotNull(head);
UIComponent body = root.findComponent("body");
- assertNotNull(body);
+ Assert.assertNotNull(body);
StringWriter sw = new StringWriter();
MockResponseWriter mrw = new MockResponseWriter(sw);
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlTestCase.java Fri Jul 2 00:31:07 2010
@@ -30,15 +30,14 @@ import javax.faces.component.html.HtmlCo
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlPanelGrid;
-import javax.faces.context.FacesContext;
import org.apache.myfaces.renderkit.html.HtmlButtonRenderer;
import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
import org.apache.myfaces.renderkit.html.HtmlGridRenderer;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
public class HtmlTestCase extends FaceletTestCase {
@@ -77,36 +76,39 @@ public class HtmlTestCase extends Facele
"javax.faces.Grid", new HtmlGridRenderer());
}
+ @Test
public void testCommandComponent() throws Exception {
- this.servletRequest.getSession().setAttribute("test", new TestBean());
+ request.getSession().setAttribute("test", new TestBean());
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "componentOwner.xml");
UIComponent c = root.findComponent("cmd");
- assertNotNull("cmd", c);
+ Assert.assertNotNull("cmd", c);
Object v = c.getAttributes().get("id");
- assertEquals("id", "cmd", v);
+ Assert.assertEquals("id", "cmd", v);
ActionSource2 as2 = (ActionSource2) c;
MethodExpression me = as2.getActionExpression();
- assertNotNull("method", me);
+ Assert.assertNotNull("method", me);
String result = (String) me.invoke(facesContext.getELContext(), null);
//System.out.println(result);
}
+ @Test
public void testCommandButton() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "commandButton.xml");
UIComponent c = root.findComponent("form:button");
- assertNotNull("button", c);
+ Assert.assertNotNull("button", c);
Object v = c.getAttributes().get("id");
- assertEquals("id", "button", v);
+ Assert.assertEquals("id", "button", v);
}
+ @Test
public void testPanelGrid() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "panelGrid.xml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/SelectTestCase.java Fri Jul 2 00:31:07 2010
@@ -27,7 +27,6 @@ import javax.faces.component.html.HtmlCo
import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlMessages;
import javax.faces.component.html.HtmlSelectOneMenu;
-import javax.faces.context.FacesContext;
import javax.faces.convert.IntegerConverter;
import org.apache.myfaces.renderkit.html.HtmlButtonRenderer;
@@ -35,9 +34,8 @@ import org.apache.myfaces.renderkit.html
import org.apache.myfaces.renderkit.html.HtmlMenuRenderer;
import org.apache.myfaces.renderkit.html.HtmlMessagesRenderer;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Test;
public class SelectTestCase extends FaceletTestCase
{
@@ -80,11 +78,12 @@ public class SelectTestCase extends Face
renderKit.addRenderer(HtmlMessages.COMPONENT_FAMILY,
"javax.faces.Messages", new HtmlMessagesRenderer());
}
-
+
+ @Test
public void testSelectOne() throws Exception
{
- this.servletRequest.getSession().setAttribute("test", new TestBean());
- this.servletRequest.addParameter("testForm:alignment", "10");
+ request.getSession().setAttribute("test", new TestBean());
+ request.addParameter("testForm:alignment", "10");
UIViewRoot root = new UIViewRoot();
vdl.buildView(facesContext, root,"selectOne.xml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jsf/html/TestNbsp.java Fri Jul 2 00:31:07 2010
@@ -27,6 +27,7 @@ import org.apache.myfaces.view.facelets.
import org.apache.myfaces.view.facelets.FaceletFactory;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.junit.Test;
public class TestNbsp extends FaceletTestCase
{
@@ -48,6 +49,7 @@ public class TestNbsp extends FaceletTes
{
}
+ @Test
public void testNbsp() throws Exception
{
UIViewRoot root = new UIViewRoot();
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/jstl/core/JstlCoreTestCase.java Fri Jul 2 00:31:07 2010
@@ -33,12 +33,12 @@ import javax.faces.context.FacesContext;
import org.apache.myfaces.renderkit.html.HtmlButtonRenderer;
import org.apache.myfaces.renderkit.html.HtmlFormRenderer;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
+import org.apache.myfaces.test.mock.MockResponseWriter;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.bean.Employee;
import org.apache.myfaces.view.facelets.util.FastWriter;
-import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.junit.Assert;
+import org.junit.Test;
public final class JstlCoreTestCase extends FaceletTestCase {
@@ -67,6 +67,7 @@ public final class JstlCoreTestCase exte
"javax.faces.Button", new HtmlButtonRenderer());
}
+ @Test
public void testIf() throws Exception {
Map session = facesContext.getExternalContext().getSessionMap();
Employee e = new Employee();
@@ -78,7 +79,7 @@ public final class JstlCoreTestCase exte
e.setManagement(true);
vdl.buildView(facesContext, root,"if.xml");
UIComponent c = root.findComponent("form");
- assertNotNull("form is null", c);
+ Assert.assertNotNull("form is null", c);
// now make sure it isn't
e.setManagement(false);
@@ -88,9 +89,10 @@ public final class JstlCoreTestCase exte
root = facesContext.getViewRoot();
vdl.buildView(facesContext, root,"if.xml");
c = root.findComponent("form");
- assertNull("form is not null", c);
+ Assert.assertNull("form is not null", c);
}
+ @Test
public void testForEach() throws Exception {
FacesContext facesContext = FacesContext.getCurrentInstance();
Map session = facesContext.getExternalContext().getSessionMap();
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/DefineIncludeTestCase.java Fri Jul 2 00:31:07 2010
@@ -22,12 +22,10 @@ package org.apache.myfaces.view.facelets
import java.io.StringWriter;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
-import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Test;
public class DefineIncludeTestCase extends FaceletTestCase {
@@ -47,7 +45,8 @@ public class DefineIncludeTestCase exten
protected void setupRenderers() throws Exception
{
}
-
+
+ @Test
public void testDefineInclude() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "defineInclude.xml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java Fri Jul 2 00:31:07 2010
@@ -31,6 +31,7 @@ import org.apache.myfaces.view.facelets.
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.junit.Test;
public class IncludeParamTestCase extends FaceletTestCase
{
@@ -56,11 +57,12 @@ public class IncludeParamTestCase extend
new HtmlTextRenderer());
}
+ @Test
public void testCaching() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
- this.servletRequest.setAttribute("test", "test2.xml");
+ request.setAttribute("test", "test2.xml");
vdl.buildView(facesContext, root, "test1.xml");
FastWriter fw = new FastWriter();
@@ -72,7 +74,7 @@ public class IncludeParamTestCase extend
ComponentSupport.removeTransient(root);
- this.servletRequest.setAttribute("test", "test3.xml");
+ request.setAttribute("test", "test3.xml");
facesContext.setViewRoot(facesContext.getApplication().getViewHandler()
.createView(facesContext, "/test"));
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/RepeatTestCase.java Fri Jul 2 00:31:07 2010
@@ -39,6 +39,8 @@ import org.apache.myfaces.view.facelets.
import org.apache.myfaces.view.facelets.bean.Example;
import org.apache.myfaces.view.facelets.component.UIRepeat;
import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Tests for UIRepeat.
@@ -49,6 +51,7 @@ import org.apache.myfaces.view.facelets.
public class RepeatTestCase extends FaceletTestCase
{
+ @Test
public void testRepeat() throws Exception
{
Company c = Example.createCompany();
@@ -69,6 +72,7 @@ public class RepeatTestCase extends Face
* Tests UIRepeat.invokeOnComponent() including var and varStatus properties.
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testInvokeOnComponent() throws IOException
{
@@ -98,49 +102,49 @@ public class RepeatTestCase extends Face
// invokeOnComponent on UIRepeat itself
String invokeId = "form:repeat";
- assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- assertEquals(repeat, callback._lastTarget);
- assertEquals(varValue, callback._rowValue); // previous set varValue
- assertEquals(statusValue, callback._repeatStatus); // previous set statusValue
+ Assert.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ Assert.assertEquals(repeat, callback._lastTarget);
+ Assert.assertEquals(varValue, callback._rowValue); // previous set varValue
+ Assert.assertEquals(statusValue, callback._repeatStatus); // previous set statusValue
// invokeOnComponent on a child of UIRepeat in the first row
invokeId = "form:repeat:0:outputText";
- assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- assertEquals(outputText, callback._lastTarget);
- assertEquals(repeatValues[0], callback._rowValue);
- assertEquals(0, callback._index);
- assertEquals(true, callback._first);
- assertEquals(false, callback._last);
- assertEquals(true, callback._even);
+ Assert.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ Assert.assertEquals(outputText, callback._lastTarget);
+ Assert.assertEquals(repeatValues[0], callback._rowValue);
+ Assert.assertEquals(0, callback._index);
+ Assert.assertEquals(true, callback._first);
+ Assert.assertEquals(false, callback._last);
+ Assert.assertEquals(true, callback._even);
// invokeOnComponent on a child of UIRepeat in the second row
invokeId = "form:repeat:1:outputText";
- assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- assertEquals(outputText, callback._lastTarget);
- assertEquals(repeatValues[1], callback._rowValue);
- assertEquals(1, callback._index);
- assertEquals(false, callback._first);
- assertEquals(false, callback._last);
- assertEquals(false, callback._even);
+ Assert.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ Assert.assertEquals(outputText, callback._lastTarget);
+ Assert.assertEquals(repeatValues[1], callback._rowValue);
+ Assert.assertEquals(1, callback._index);
+ Assert.assertEquals(false, callback._first);
+ Assert.assertEquals(false, callback._last);
+ Assert.assertEquals(false, callback._even);
// invokeOnComponent on a child of UIRepeat in the third row
invokeId = "form:repeat:2:outputText";
- assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
- assertEquals(outputText, callback._lastTarget);
- assertEquals(repeatValues[2], callback._rowValue);
- assertEquals(2, callback._index);
- assertEquals(false, callback._first);
- assertEquals(true, callback._last);
- assertEquals(true, callback._even);
+ Assert.assertTrue(root.invokeOnComponent(facesContext, invokeId, callback));
+ Assert.assertEquals(outputText, callback._lastTarget);
+ Assert.assertEquals(repeatValues[2], callback._rowValue);
+ Assert.assertEquals(2, callback._index);
+ Assert.assertEquals(false, callback._first);
+ Assert.assertEquals(true, callback._last);
+ Assert.assertEquals(true, callback._even);
// invokeOnComponent on a child of UIRepeat with invalid row (-1)
invokeId = "form:repeat:outputText";
- assertFalse(root.invokeOnComponent(facesContext, invokeId, callback));
+ Assert.assertFalse(root.invokeOnComponent(facesContext, invokeId, callback));
// after all these calls to invokeOnComponent, row and status still
// have to be the same like before
- assertEquals(varValue, externalContext.getRequestMap().get(var));
- assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
+ Assert.assertEquals(varValue, externalContext.getRequestMap().get(var));
+ Assert.assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
// remove the values from the request map
externalContext.getRequestMap().remove("repeatValues");
@@ -211,6 +215,7 @@ public class RepeatTestCase extends Face
* Tests UIRepeat.visitTree().
* @throws IOException
*/
+ @Test
@SuppressWarnings("unchecked")
public void testVisitTree() throws IOException
{
@@ -248,12 +253,12 @@ public class RepeatTestCase extends Face
expectedClientIds.add("form:repeat:2:outputText");
// see if we got the expected result
- assertEquals(expectedClientIds, testVisitCallback._visitedClientIds);
+ Assert.assertEquals(expectedClientIds, testVisitCallback._visitedClientIds);
// after the tree visit, row and status still
// have to be the same like before
- assertEquals(varValue, externalContext.getRequestMap().get(var));
- assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
+ Assert.assertEquals(varValue, externalContext.getRequestMap().get(var));
+ Assert.assertEquals(statusValue, externalContext.getRequestMap().get(varStatus));
// remove the values from the request map
externalContext.getRequestMap().remove("repeatValues");
@@ -288,7 +293,7 @@ public class RepeatTestCase extends Face
final String clientId = target.getClientId(context.getFacesContext());
if (_visitedClientIds.contains(clientId))
{
- fail("Component with clientId " + clientId + " visited twice!");
+ Assert.fail("Component with clientId " + clientId + " visited twice!");
}
else
{
@@ -301,15 +306,15 @@ public class RepeatTestCase extends Face
Object indexObject = _indexValueExpression.getValue(elCtx);
// indexObject has to be an Integer
- assertTrue(indexObject instanceof Integer);
+ Assert.assertTrue(indexObject instanceof Integer);
Integer index = (Integer) indexObject;
// the index has to be part of the clientId
- assertTrue(clientId.contains("" + index));
+ Assert.assertTrue(clientId.contains("" + index));
Object rowValue = _rowValueExpression.getValue(elCtx);
// #{row} has to be the repeatValue for the current index
- assertEquals(_repeatValues[index], rowValue);
+ Assert.assertEquals(_repeatValues[index], rowValue);
}
}
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TemplateTestCase.java Fri Jul 2 00:31:07 2010
@@ -20,13 +20,11 @@
package org.apache.myfaces.view.facelets.tag.ui;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.util.FastWriter;
+import org.junit.Test;
public class TemplateTestCase extends FaceletTestCase {
@@ -46,7 +44,8 @@ public class TemplateTestCase extends Fa
protected void setupRenderers() throws Exception
{
}
-
+
+ @Test
public void testOutput() throws Exception {
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "s_page.xhtml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/TestUserTags.java Fri Jul 2 00:31:07 2010
@@ -29,6 +29,7 @@ import org.apache.myfaces.view.facelets.
import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.view.facelets.util.FastWriter;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.junit.Test;
public class TestUserTags extends FaceletTestCase {
@@ -53,8 +54,9 @@ public class TestUserTags extends Facele
"javax.faces.Text", new HtmlTextRenderer());
}
+ @Test
public void testClientClient() throws Exception {
- this.servletRequest.setAttribute("test", "foo");
+ request.setAttribute("test", "foo");
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "test-tags.xml");
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/UITestCase.java Fri Jul 2 00:31:07 2010
@@ -23,12 +23,11 @@ import java.util.HashMap;
import java.util.Map;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import org.apache.myfaces.view.facelets.Facelet;
-import org.apache.myfaces.view.facelets.FaceletFactory;
-import org.apache.myfaces.view.facelets.FaceletTestCase;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.junit.Assert;
+import org.junit.Test;
public class UITestCase extends FaceletTestCase
{
@@ -52,6 +51,7 @@ public class UITestCase extends FaceletT
{
}
+ @Test
public void testRelativePaths() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
@@ -67,18 +67,21 @@ public class UITestCase extends FaceletT
//System.out.println("************************");
}
+ @Test
public void testCompositionTemplate() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition-template.xml");
}
+ @Test
public void testCompositionTemplateSimple() throws Exception
{
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "composition-template-simple.xml");
}
+ @Test
public void testComponent() throws Exception
{
Map map = new HashMap();
@@ -87,8 +90,8 @@ public class UITestCase extends FaceletT
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "component.xml");
- assertEquals("only one child, the component", 1, root.getChildCount());
- assertNotNull("bound to map", map.get("c"));
+ Assert.assertEquals("only one child, the component", 1, root.getChildCount());
+ Assert.assertNotNull("bound to map", map.get("c"));
}
/*
Modified: myfaces/core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/pom.xml?rev=959818&r1=959817&r2=959818&view=diff
==============================================================================
--- myfaces/core/trunk/pom.xml (original)
+++ myfaces/core/trunk/pom.xml Fri Jul 2 00:31:07 2010
@@ -149,11 +149,11 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.3.1</version>
+ <version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.3.1</version>
+ <version>2.5</version>
</plugin>
</plugins>
</pluginManagement>