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/06 00:10:33 UTC
svn commit: r514907 - in
/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock: ./
ExceptionMockRunner.java MockRunner.java
Author: mbr
Date: Mon Mar 5 15:10:32 2007
New Revision: 514907
URL: http://svn.apache.org/viewvc?view=rev&rev=514907
Log:
support classes for mock tests
Added:
myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/
myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java (with props)
myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java (with props)
Added: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java?view=auto&rev=514907
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java (added)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java Mon Mar 5 15:10:32 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.mock;
+
+import org.apache.myfaces.TestRunner;
+import org.easymock.classextension.IMocksControl;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class ExceptionMockRunner extends MockRunner implements TestRunner
+{
+
+ private final Throwable _exception;
+
+ public ExceptionMockRunner(IMocksControl mockControl, Throwable exception)
+ {
+ super(mockControl);
+ _exception = exception;
+ }
+
+ @Override
+ protected final void setUp(IMocksControl mockControl)
+ {
+ setUp(mockControl, _exception);
+ }
+
+ protected abstract void setUp(IMocksControl mockControl, Throwable exceptionToThrow);
+
+}
Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/ExceptionMockRunner.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java?view=auto&rev=514907
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java (added)
+++ myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java Mon Mar 5 15:10:32 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.mock;
+
+import org.apache.myfaces.TestRunner;
+import org.easymock.classextension.IMocksControl;
+
+/**
+ * @author Mathias Broekelmann (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public abstract class MockRunner implements TestRunner
+{
+ private final IMocksControl _mockControl;
+
+ public MockRunner(IMocksControl mockControl)
+ {
+ _mockControl = mockControl;
+ }
+
+ public final void run() throws Throwable
+ {
+ setUp(_mockControl);
+ _mockControl.replay();
+ run(_mockControl);
+ _mockControl.verify();
+ }
+
+ protected abstract void run(IMocksControl mockControl) throws Exception;
+
+ protected abstract void setUp(IMocksControl mockControl);
+
+}
Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: myfaces/core/branches/jsf12/impl/src/test/java/org/apache/myfaces/mock/MockRunner.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL