You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mb...@apache.org on 2007/03/12 22:16:48 UTC

svn commit: r517402 - /myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java

Author: mbr
Date: Mon Mar 12 14:16:47 2007
New Revision: 517402

URL: http://svn.apache.org/viewvc?view=rev&rev=517402
Log:
Base Class for EasyMock Tests

Added:
    myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java   (with props)

Added: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java?view=auto&rev=517402
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java (added)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java Mon Mar 12 14:16:47 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.myfaces;
+
+import javax.el.ELContext;
+import javax.faces.application.Application;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.MockFacesContext;
+
+import junit.framework.TestCase;
+
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class FacesTestCase extends TestCase
+{
+    protected FacesContext _facesContext;
+    protected IMocksControl _mocksControl;
+    protected ExternalContext _externalContext;
+    protected Application _application;
+    protected ELContext _elContext;
+
+    protected void setUp() throws Exception
+    {
+        _mocksControl = EasyMock.createControl();
+        _externalContext = _mocksControl.createMock(ExternalContext.class);
+        MockFacesContext.setCurrentInstance(_facesContext);
+        _facesContext = _mocksControl.createMock(FacesContext.class);
+        _application = _mocksControl.createMock(Application.class);
+        _elContext = _mocksControl.createMock(ELContext.class);        
+    }
+    
+    @Override
+    protected void tearDown() throws Exception
+    {
+        MockFacesContext.setCurrentInstance(null);
+    }
+}

Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/FacesTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL