You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(13) |
Aug
(151) |
Sep
(21) |
Oct
(6) |
Nov
(70) |
Dec
(8) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(47) |
Feb
(66) |
Mar
(23) |
Apr
(115) |
May
(24) |
Jun
(53) |
Jul
(10) |
Aug
(279) |
Sep
(84) |
Oct
(149) |
Nov
(138) |
Dec
(52) |
2003 |
Jan
(22) |
Feb
(20) |
Mar
(29) |
Apr
(106) |
May
(170) |
Jun
(122) |
Jul
(70) |
Aug
(64) |
Sep
(27) |
Oct
(71) |
Nov
(49) |
Dec
(9) |
2004 |
Jan
(7) |
Feb
(38) |
Mar
(3) |
Apr
(9) |
May
(22) |
Jun
(4) |
Jul
(1) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
(15) |
Dec
(2) |
2005 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
(28) |
Jun
(3) |
Jul
(11) |
Aug
(5) |
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2006 |
Jan
(8) |
Feb
(3) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jeff M. <je...@mk...> - 2002-10-30 10:45:06
|
I've added this item to the mo front page. Only problem is I can't overwrite the last version of the file that's up at the moment. (Steve can you tweak the file perms for me) Just out of interest has anyone had any of the .NET stuff working with mono? Can't seem to get anything to compile. On Wed, 2002-10-30 at 05:00, Griffin Caprio wrote: > This is announcing the second release of the .NET Mock Object library, > version 0.2. > > Change log can be viewed here: > https://sourceforge.net/project/shownotes.php?group_id=54948&release_id=119404 > > Download the release here: > https://sourceforge.net/project/showfiles.php?group_id=54948&release_id=119404 > > As always, feedback is welcome. > > -Griffin > > > > _________________________________________________________________ > Choose an Internet access plan right for you -- try MSN! > http://resourcecenter.msn.com/access/plans/default.asp > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Mockobjects-java-dev mailing list > Moc...@li... > https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |
From: Jeff M. <cus...@us...> - 2002-10-30 10:41:13
|
Update of /cvsroot/mockobjects/mockobjects-java/doc/html In directory usw-pr-cvs1:/tmp/cvs-serv9591/doc/html Modified Files: index.html Log Message: Added .NET mock release to news items Index: index.html =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/doc/html/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- index.html 21 Oct 2002 22:50:26 -0000 1.3 +++ index.html 30 Oct 2002 10:41:08 -0000 1.4 @@ -26,7 +26,7 @@ with a bias towards Mock Objects. </li> </ul> -<p>Our larger goal is to make<a href="www.mockobjects.com">www.mockobjects.com</a> +<p>Our larger goal is to make <a href="www.mockobjects.com">www.mockobjects.com</a> the point of reference for ideas and tools for unit testing particularly based on Mock Objects. Our first implementation is in Java, largely because that's what we've been working in, but also because it has a stable set of @@ -37,6 +37,17 @@ <table cellpadding="2" cellspacing="2" border="0" width="100%"> <tbody> + <tr align="left" valign="top" rowspan="1" colspan="1" + bgcolor="#a0ddf0"> + <td valign="top"><span class="c11">2002/10/30</span> </td> + <td valign="top"><span class="c11"> + Griffin Caprio has released <a +href="http://sourceforge.net/project/showfiles.php?group_id=54948&release_id=119404">.NET Mockobjects 0.2</a>. List of +<a +href="http://sourceforge.net/project/shownotes.php?group_id=54948&release_id=119404">changes</a> + </span> + </td> + </tr> <tr align="left" valign="top" rowspan="1" colspan="1" bgcolor="#a0ddf0"> <td valign="top"><span class="c11">2002/10/20</span> </td> |
From: Griffin C. <gri...@ho...> - 2002-10-30 05:01:05
|
This is announcing the second release of the .NET Mock Object library, version 0.2. Change log can be viewed here: https://sourceforge.net/project/shownotes.php?group_id=54948&release_id=119404 Download the release here: https://sourceforge.net/project/showfiles.php?group_id=54948&release_id=119404 As always, feedback is welcome. -Griffin _________________________________________________________________ Choose an Internet access plan right for you -- try MSN! http://resourcecenter.msn.com/access/plans/default.asp |
From: Steve F. <st...@m3...> - 2002-10-27 23:09:27
|
Looking at this, one solution is not to use a Verifiable for the connection. You need a stub here, more than a mock and you're not really testing anything about how the connection behaves. You can knock up a stub implementation very quickly using anonymous classes in front of a null implementation. Alternatively, you could relax the access on the static statement and set it during the test. Alternatively, you could get more sophisticated and use AspectJ to intercept the call. From: "Simon Levitt" <sim...@uk...> > StrawMan: > > public class DataObject > { > private static Statment stmt = Global.getConnection().createStatement(); > > public DataObject(String name, int flags, boolean readOnlyRecord) > { > > public static DataObject load(String id) > { > try { > result = stmt.executeQuery("SELECT * FROM table WHERE id = " + id); > if (result.next()) { > obj = new DataObject(result.getString(1), result.getInt(3), > stmt.getConnection().isReadOnly()); > [...] > > > I figure that this will be a reasonably lightweight mechanism for > > understanding each other and for pushing the dialogue along. One case > > at a time... > > > This is probably the biggest difference, I'm not looking at a specific > single case, I'm thinking more generally. I was just trying to find a way to get there gradually, rather than in one go. > Whilst I think its important, more from a perception of MockObjects point > of view I don't much care if its taken on board any more. Particularly as > we appear to be the only two concerned about it in any form. I'm not sure that's completely true. There are quite a few lurkers. > I'd much rather be spending time presenting the rationisation I've done > for the sql objects in general in preparation for the PreparedStatement > work I was going to do - which I suspect treads on your beliefs of single > situation Mocks and no test cases (as it uses the same implementation of > ResultSet for multi and single row results, and has test cases to ensure > the various combinations of build methods give the same results). Well, I'm beginning to soften on No Test Cases, simply because I can't remember what everything does any more. That said, Nat Pryce and I have been doing some interesting work with dynamic proxies that might make some of the issues go away. I don't know if we'll ever achieve a complete implementation of the standard, so maybe we should try to go around the problem. Hmmm. I'll take another look at your previous proposal. S. |
From: Steve F. <sm...@us...> - 2002-10-27 22:29:26
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv31168/src/core/com/mockobjects/dynamic Modified Files: Mock.java Log Message: introduced a couple of variables to remove duplication Index: Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Mock.java 27 Oct 2002 11:45:59 -0000 1.4 +++ Mock.java 27 Oct 2002 22:29:23 -0000 1.5 @@ -99,9 +99,10 @@ * The call to be mocked. */ public void setup( ExpectedCall call ) { - _expectations.put( call.getMethodName(), call ); - _not_called_expectations.remove( call.getMethodName() ); - _called_methods.add( call.getMethodName() ); + String methodName = call.getMethodName(); + _expectations.put( methodName, call ); + _not_called_expectations.remove( methodName ); + _called_methods.add( methodName ); } /** @@ -157,9 +158,10 @@ * An object describing the expected call and mocking its behaviour. */ public void expect( ExpectedCall call ) { - _expectations.put( call.getMethodName(), call ); - _not_called_expectations.remove( call.getMethodName() ); - _called_methods.remove( call.getMethodName() ); + String methodName = call.getMethodName(); + _expectations.put( methodName, call ); + _not_called_expectations.remove( methodName ); + _called_methods.remove( methodName ); } /** |
From: Steve F. <sm...@us...> - 2002-10-27 22:24:19
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv29456/src/core/test/mockobjects Modified Files: TestAssertMo.java Log Message: Tidied up imports Index: TestAssertMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/TestAssertMo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestAssertMo.java 25 Oct 2002 22:06:07 -0000 1.2 +++ TestAssertMo.java 27 Oct 2002 22:24:13 -0000 1.3 @@ -1,9 +1,12 @@ package test.mockobjects; +import com.mockobjects.util.AssertMo; +import com.mockobjects.util.TestCaseMo; +import junit.framework.AssertionFailedError; +import junit.framework.Test; +import junit.framework.TestSuite; + import java.util.Vector; -import junit.framework.*; -import com.mockobjects.*; -import com.mockobjects.util.*; public class TestAssertMo extends TestCaseMo { private static final Class THIS = TestAssertMo.class; @@ -171,4 +174,5 @@ } fail("Should have thrown an exception"); } + } |
From: Steve F. <sm...@us...> - 2002-10-27 11:46:35
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv15871 Modified Files: build.xml Log Message: incremented version count Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- build.xml 22 Oct 2002 23:09:35 -0000 1.28 +++ build.xml 27 Oct 2002 11:46:32 -0000 1.29 @@ -18,7 +18,7 @@ <target name="project-properties"> <property name="project.fullname" value="Mock Objects" /> - <property name="project.version" value="0.6" /> + <property name="project.version" value="0.07" /> <property name="project.name" value="mockobjects" /> <property name="year" value="2002" /> <property name="debug" value="on" /> @@ -41,7 +41,7 @@ <property name="j2ee.lib" value="lib/j2ee.jar" /> </target> - <target name="deliverable-names" + <target name="deliverable-names" depends="project-properties"> <property name="dist.dir" value="dist" /> <property name="jar.base.name" value="mockobjects-${project.version}" /> @@ -58,7 +58,7 @@ </patternset> </target> - <target name="check-availabilities" + <target name="check-availabilities" depends="source-locations"> <path id="lib.classpath"> <fileset dir="${lib.dir}"> @@ -123,7 +123,7 @@ <javac destdir="${core.classes}" debug="${debug}" verbose="false" - optimize="${optimize}" + optimize="${optimize}" srcdir="${src.core.dir}"> <classpath> @@ -133,7 +133,7 @@ </javac> </target> - <target name="compile-jdk" + <target name="compile-jdk" depends="compile-core" description="Compile all the java files for included libraries"> <mkdir dir="${jdk.classes}" /> @@ -152,8 +152,8 @@ </javac> </target> - <target name="compile-j2ee" - depends="compile-jdk" + <target name="compile-j2ee" + depends="compile-jdk" if="j2ee.version" description="Compile all the java files for included libraries"> @@ -263,9 +263,9 @@ depends="deliverable-names, junit" description="Generate jdk mockobjects jar"> <antcall target="_inner-jar"> - <param name="jarfile.name" + <param name="jarfile.name" value="${out.dir}/${jar.base.name}-jdk${jdk.version}.jar" /> - <param name="alt.jarfile.name" + <param name="alt.jarfile.name" value="${out.dir}/${alt.jar.base.name}-jdk${jdk.version}.jar" /> <param name="classes.dir" value="${jdk.classes}" /> </antcall> @@ -276,9 +276,9 @@ if="j2ee.version" description="Generate j2ee mockobjects jar"> <antcall target="_inner-jar"> - <param name="jarfile.name" + <param name="jarfile.name" value="${out.dir}/${jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> - <param name="alt.jarfile.name" + <param name="alt.jarfile.name" value="${out.dir}/${alt.jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> <param name="classes.dir" value="${j2ee.classes}" /> </antcall> @@ -303,7 +303,7 @@ </jar> </target> - <target name="jar-ext-httpclient" + <target name="jar-ext-httpclient" depends="junit, compile-ext-httpclient" description="Generate extension mockobjects jar"> <jar jarfile="${out.dir}/mockobjects-httpclient.jar" @@ -324,9 +324,9 @@ depends="call-me-first, deliverable-names" unless="javadoc.notrequired" description="Generate the javadoc for the current version"> - <javadoc packagenames="com.mockobjects.*,alt.*" + <javadoc packagenames="com.mockobjects.*,alt.*" destdir="${out.javadoc.dir}" - author="true" + author="true" public="true" version="true" use="true" windowtitle="${project.fullname} ${project.version}" doctitle="${project.fullname} ${project.version}" |
From: Steve F. <sm...@us...> - 2002-10-27 11:46:04
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv15671/src/core/com/mockobjects/dynamic Modified Files: Mock.java Log Message: layout and twiddly refactorings Index: Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Mock.java 25 Oct 2002 22:06:59 -0000 1.3 +++ Mock.java 27 Oct 2002 11:45:59 -0000 1.4 @@ -1,5 +1,5 @@ /* Copyright (c) 2002 Nat Pryce. All rights reserved. - * + * * Created on February 10, 2002, 11:06 PM */ package com.mockobjects.dynamic; @@ -14,31 +14,34 @@ import java.util.*; -/** A convenient class for creating simple +/** + * A convenient class for creating simple * <a href="http://www.mockobjects.com">mock objects</a>. */ -public class Mock +public class Mock extends Assert implements InvocationHandler, Verifiable { public static final Object VOID = new Object(); - /** A convenient constant for defining expectations for methods that + /** + * A convenient constant for defining expectations for methods that * have no methods. */ public static final Predicate[] NO_ARGS = new Predicate[0]; - + private String _name; private Map _expectations = new HashMap(); private Set _not_called_expectations = new HashSet(); private Map _order_constraints = new HashMap(); private Set _called_methods = new HashSet(); private boolean _strict = false; - + private Map _default_results = new HashMap(); - - - /** Creates a named Mock object, The name will be included in the messages + + + /** + * Creates a named Mock object, The name will be included in the messages * of exceptions thrown to indicate violated expectations. */ public Mock( String name ) { @@ -53,8 +56,9 @@ setupDefaultResult( char.class, new Character('\0') ); setupDefaultResult( String.class, "" ); } - - /** Creates a Mock object and automatically assigns a name to it. The assigned + + /** + * Creates a Mock object and automatically assigns a name to it. The assigned * name will include the name of the concrete class and a unique identifier of * this instance, but will not be particularly user friendly when included in * error messages. Therefore, it is recommended that you explictly name mock @@ -64,16 +68,18 @@ this(null); _name = super.toString(); } - - /** Returns the Mock's name. + + /** + * Returns the Mock's name. */ public String toString() { return _name; } - - /** Is the mock in strict mode? In strict mode the mock will throw + + /** + * Is the mock in strict mode? In strict mode the mock will throw * {@link junit.framework.AssertionFailedError} exceptions when - * unexpected method calls are made. Otherwise, the mock ignore + * unexpected method calls are made. Otherwise, the mock ignore * the call or return default arguments. */ public boolean isStrict() { @@ -83,11 +89,12 @@ public void setStrict( boolean strict ) { _strict = strict; } - - /** Mock the behaviour of a method without requiring that the method + + /** + * Mock the behaviour of a method without requiring that the method * actually be called. Note: the ExpectedCall may check the arguments * of the call but should usually not do so. - * + * * @param call * The call to be mocked. */ @@ -96,11 +103,12 @@ _not_called_expectations.remove( call.getMethodName() ); _called_methods.add( call.getMethodName() ); } - - /** Set up calls to <var>method</var> to return <var>result</var>, + + /** + * Set up calls to <var>method</var> to return <var>result</var>, * but do not define any expectations upon arguments to those calls. * Arguments of calls to <var>method</var> will be ignored. - * + * * @param method_name * The name of the method that will be called. * @param result @@ -111,8 +119,9 @@ public void setupResult( String method_name, Object result ) { setup( new ExpectedReturn( method_name, null, result ) ); } - - /** Set up calls to <var>method</var> to throw <var>exception</var>, + + /** + * Set up calls to <var>method</var> to throw <var>exception</var>, * but do not define any expectations upon arguments to those calls. * Arguments of calls to <var>method</var> will be ignored. * @@ -124,12 +133,13 @@ public void setupThrow( String method_name, Throwable exception ) { setup( new ExpectedThrow( method_name, null, exception ) ); } - - /** Set up the value returned by methods that have the given result + + /** + * Set up the value returned by methods that have the given result * type, if no result or exception has been explicitly defined for * the called method by {@link #setupResult}, {@link #setupThrow}, * {@link #expectReturn} or {@link #expectThrow}. - * + * * @param result_type * The result type of methods to be mocked. * @param result_value @@ -139,8 +149,9 @@ public void setupDefaultResult( Class result_type, Object result_value ) { _default_results.put( result_type, result_value ); } - - /** Expect a method call and mock the behaviour of that call. + + /** + * Expect a method call and mock the behaviour of that call. * * @param call * An object describing the expected call and mocking its behaviour. @@ -150,9 +161,10 @@ _not_called_expectations.remove( call.getMethodName() ); _called_methods.remove( call.getMethodName() ); } - - /** Expect a method call and return a result when it is called. - * + + /** + * Expect a method call and return a result when it is called. + * * @param method * The name of the method that will be called. * @param args @@ -167,8 +179,9 @@ public void expectReturn( String method, Predicate[] args, Object result ) { expect( new ExpectedReturn( method, args, result ) ); } - - /** Expect a method call and return a result when it is called. + + /** + * Expect a method call and return a result when it is called. * * @param method * The name of the method that will be called. @@ -183,7 +196,8 @@ expectReturn(method, P.args(P.eq(arg)), result); } - /** Expect a method call with no parameters and return a result when it is called. + /** + * Expect a method call with no parameters and return a result when it is called. * * @param method * The name of the method that will be called. @@ -196,8 +210,9 @@ expectReturn(method, NO_ARGS, result ); } - /** Expect a call to a method with a void return type. - * + /** + * Expect a call to a method with a void return type. + * * @param method * The name of the method that will be called. * @param args @@ -209,7 +224,8 @@ expect( new ExpectedReturn( method, args, VOID ) ); } - /** Expect a call to a method with a void return type. + /** + * Expect a call to a method with a void return type. * * @param method * The name of the method that will be called. @@ -220,7 +236,8 @@ expectVoid(method, P.args(P.eq(arg))); } - /** Expect a call to a method with a void return type and no parameters + /** + * Expect a call to a method with a void return type and no parameters * * @param method * The name of the method that will be called. @@ -229,8 +246,9 @@ expectVoid(method, NO_ARGS); } - /** Expect a method call and throw an exception or error when it is called. - * + /** + * Expect a method call and throw an exception or error when it is called. + * * @param method * The name of the method that will be called. * @param args @@ -243,8 +261,9 @@ public void expectThrow( String method, Predicate[] args, Throwable exception ) { expect( new ExpectedThrow( method, args, exception ) ); } - - /** Expect a method call and throw an exception or error when it is called. + + /** + * Expect a method call and throw an exception or error when it is called. * * @param method * The name of the method that will be called. @@ -257,7 +276,8 @@ expectThrow( method, P.args(P.eq(arg)), exception ); } - /** Expect a method call with no parameters and throw an exception or error when it is called. + /** + * Expect a method call with no parameters and throw an exception or error when it is called. * * @param method * The name of the method that will be called. @@ -268,61 +288,62 @@ expectThrow( method, NO_ARGS, exception ); } - /** Expect a method not to be called. + /** + * Expect a method not to be called. * An {@link junit.framework.AssertionFailedError} will be thrown if * the method is called. - * + * * @param method * The name of the method that will not be called. */ public void expectNotCalled( String method ) { _not_called_expectations.add(method); } - - /** Define an order between two calls. The method named + + /** + * Define an order between two calls. The method named * <var>subsequent_method</var> <em>must</em> be called after * the method namd <var>preceding_method</var>, otherwise an * {@link junit.framework.AssertionFailedError} will be thrown. */ public void order( String preceding_method, String subsequent_method ) { - Set preceding_calls; - if( _order_constraints.containsKey(subsequent_method) ) { - preceding_calls = (Set)_order_constraints.get(subsequent_method); - } else { + Set preceding_calls = orderConstraintsFor(subsequent_method); + if( null == preceding_calls) { preceding_calls = new HashSet(); _order_constraints.put( subsequent_method, preceding_calls ); } - + preceding_calls.add( preceding_method ); } - - /** Called by the {@link java.lang.reflect.Proxy} to mock the behaviour of an + + /** + * Called by the {@link java.lang.reflect.Proxy} to mock the behaviour of an * invoked method and check expectations. */ public Object invoke( Object obj, Method method, Object[] args ) throws Throwable { _called_methods.add( method.getName() ); - + try { - return getClass().getMethod( + return getClass().getMethod( method.getName(), method.getParameterTypes() ).invoke( this, args ); } catch( NoSuchMethodException ex ) { return mockCall( method, args ); } } - + protected Object mockCall( Method method, Object[] args ) throws Throwable { String method_name = method.getName(); - + assertCanBeCalled( method_name ); - + if( _expectations.containsKey( method_name ) ) { ExpectedCall expected = (ExpectedCall)_expectations.get(method_name); - + checkCallOrder( method_name ); if( expected.isTestingArguments() ) { checkArguments( expected, args ); @@ -348,39 +369,38 @@ private void checkCallOrder( String method_name ) { if( _order_constraints.containsKey(method_name) ) { - assertMethodsHaveBeenCalled( - (Set)_order_constraints.get(method_name) ); + assertMethodsHaveBeenCalled(orderConstraintsFor(method_name) ); } } - + + private Set orderConstraintsFor(String method_name) { + return (Set)_order_constraints.get(method_name); + } + private void checkArguments( ExpectedCall expected, Object[] args ) { int arg_count = (args == null) ? 0 : args.length; assertEquals( _name + ": wrong number of arguments to " + expected.getMethodName() + " method", expected.getArgumentCount(), arg_count ); - + for( int i = 0; i < arg_count; i++ ) { Object arg = args[i]; if( !expected.testArgument( i, arg ) ) { fail( _name + ": unexpected argument " + (i+1) + " to " + expected.getMethodName() + " method" + - ", expected " + expected.describeArgument(i) + + ", expected " + expected.describeArgument(i) + ", was " + arg ); } } } - - private Object defaultResult( Class return_type ) { - if( _default_results.containsKey(return_type) ) { - return _default_results.get(return_type); - } else { - return null; - } + + private Object defaultResult(Class return_type) { + return _default_results.get(return_type); } - - /** Fails if not all the expected calls have been made to this mock object. - * + + /** + * Fails if not all the expected calls have been made to this mock object. * @throws junit.framework.AssertionFailedError * Not all expected calls were made to this mock object. */ @@ -389,29 +409,29 @@ } private void assertAllExpectedMethodsCalled() { - + assertMethodsHaveBeenCalled( _expectations.keySet() ); } - + private void assertMethodsHaveBeenCalled( Set method_names ) { Iterator i = method_names.iterator(); while( i.hasNext() ) { assertHasBeenCalled( (String)i.next() ); } } - - private void assertCanBeCalled( String method_name ) { - if( _not_called_expectations.contains(method_name) ) { - fail(_name + ": unexpected call to method " + method_name ); - } - } - + private void assertHasBeenCalled( String method_name ) { if( !_called_methods.contains(method_name) ) { fail( _name + ": method " + method_name + " was not called" ); } } - + + private void assertCanBeCalled( String method_name ) { + if( _not_called_expectations.contains(method_name) ) { + fail(_name + ": unexpected call to method " + method_name ); + } + } + public Object createInterface( Class interface_class ) { return createInterface(interface_class, this); } |
From: Steve F. <sm...@us...> - 2002-10-25 22:08:13
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv31713/src/core/test/mockobjects/dynamic Added Files: MockTrainerTest.java Log Message: started dynamic.Trainer --- NEW FILE: MockTrainerTest.java --- package test.mockobjects.dynamic; import com.mockobjects.dynamic.Mock; import com.mockobjects.util.TestCaseMo; /* * Date: 25-Oct-2002 */ public class MockTrainerTest extends TestCaseMo { private Mock exampleMock = new Mock("example"); private Example trainer = (Example)exampleMock.getTrainer(Example.class); private Example example = (Example)exampleMock.createInterface(Example.class); public MockTrainerTest(String s) { super(s); } public void testDontCallEmptyMethod() { trainer.anEmptyMethod(); assertFails("should fail when did not call trained method", new Runnable() { public void run() { exampleMock.verify(); } }); } public void testCallEmptyMethod() { trainer.anEmptyMethod(); example.anEmptyMethod(); exampleMock.verify(); } public void testCallVoidMethodWithArg() { trainer.aVoidWithArgMethod("value"); example.aVoidWithArgMethod("value"); exampleMock.verify(); } public void testCallVoidMethodWithWrongArg() { trainer.aVoidWithArgMethod("value"); assertFails("should fail when input parameter different", new Runnable() { public void run() { example.aVoidWithArgMethod("another"); } }); } static public interface Example { void anEmptyMethod(); void aVoidWithArgMethod(Object anObject); } } |
From: Steve F. <sm...@us...> - 2002-10-25 22:08:12
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv31713/src/core/com/mockobjects/dynamic Added Files: Trainer.java Log Message: started dynamic.Trainer --- NEW FILE: Trainer.java --- package com.mockobjects.dynamic; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; /* * Date: 25-Oct-2002 */ public class Trainer implements InvocationHandler { Mock mock; public Trainer( Mock mockToBeTrained ) { mock = mockToBeTrained; } public Object invoke( Object o, Method method, Object[] objects ) throws Throwable { mock.expectVoid( method.getName(), createExpectations(objects) ); return null; } private Predicate[] createExpectations(Object[] objects) { return objects == null ? Mock.NO_ARGS : new Predicate[] {P.eq(objects[0])}; } } |
From: Steve F. <sm...@us...> - 2002-10-25 22:07:50
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv31545/src/core/test/mockobjects/dynamic Added Files: MockTest.java Removed Files: Test_Mock.java Log Message: renamed Test_Mock to MockTest refactored some tests to use assertFails() --- NEW FILE: MockTest.java --- /* Copyright (c) 2002 Nat Pryce. All rights reserved. * * Created on February 11, 2002, 12:34 AM */ package test.mockobjects.dynamic; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import junit.framework.AssertionFailedError; import com.mockobjects.dynamic.*; import com.mockobjects.util.TestCaseMo; public class MockTest extends TestCaseMo { public static interface ExampleInterface { Object noArgs(); void voidMethod(); String objectTypes( Integer i ); int primitiveTypes( int x, int y ); void sideEffect( StringBuffer buf ); // These are used to test default return values boolean booleanResult(); byte byteResult(); char charResult(); short shortResult(); int intResult(); long longResult(); float floatResult(); double doubleResult(); String stringResult(); // Used to test ordered calls void first(); void second(); } public static class DerivedMock extends Mock { DerivedMock( String name ) { super(name); } public boolean was_called = false; public void voidMethod() { this.was_called = true; } public String objectTypes( Integer n ) throws Throwable { Method method = getClass().getMethod("objectTypes", new Class[] { Integer.class } ); return (String)mockCall( method , new Object[]{n} ); } }; private Mock _mock; private ExampleInterface _interface; public MockTest( String test ) { super(test); } public void setUp() { _mock = new Mock(); _interface = (ExampleInterface)_mock.createInterface( ExampleInterface.class ); } public void tearDown() { _mock = null; _interface = null; } public void testNewMockVerifies() { _mock.verify(); } public void testNamedMock() { Mock mock = new Mock("Name"); assertEquals( "Name", mock.toString() ); } public void testMockCallToNoArgMethod() { Object result = new Object(); _mock.expectReturn( "noArgs", Mock.NO_ARGS, result ); assertSame( result, _interface.noArgs() ); _mock.verify(); } public void testMockCallToVoidMethod() { _mock.expectVoid( "voidMethod", Mock.NO_ARGS ); _interface.voidMethod(); _mock.verify(); } public void testObjectTypes() { _mock.expectReturn( "objectTypes", new Predicate[] { new IsEqual( new Integer(1) ) }, "1" ); assertEquals( "1", _interface.objectTypes( new Integer(1) ) ); _mock.verify(); } public void testPrimitiveTypes() { _mock.expectReturn( "primitiveTypes", new Predicate[] { new IsEqual( new Integer(2) ), new IsEqual( new Integer(3) ) }, new Integer(6) ); assertEquals( 6, _interface.primitiveTypes(2,3) ); _mock.verify(); } public void testLaterExpectationsOverrideEarlierExpectations() { Object result1 = new Object(); Object result2 = new Object(); _mock.expectReturn( "noArgs", Mock.NO_ARGS, result1 ); _mock.expectReturn( "noArgs", Mock.NO_ARGS, result2 ); assertSame( result2, _interface.noArgs() ); assertSame( result2, _interface.noArgs() ); _mock.verify(); } public void testThrow() { _mock.expectThrow( "primitiveTypes", new Predicate[] { new IsEqual( new Integer(2) ), new IsEqual( new Integer(3) ) }, new ArithmeticException("message") ); try { _interface.primitiveTypes( 2, 3 ); fail( "expected ArithmeticException to be thrown" ); } catch( ArithmeticException ex ) { assertEquals( "message", ex.getMessage() ); } _mock.verify(); } public void testExpectCallWithSideEffect() { final StringBuffer buf = new StringBuffer(); _mock.expect( new ExpectedCall( "sideEffect", new Predicate[]{ new IsSame(buf) } ) { public Object eval( Object[] args ) throws Throwable { buf.append("hello"); return Mock.VOID; } } ); _interface.sideEffect( buf ); assertEquals( "hello", buf.toString() ); _mock.verify(); } public void testNotAllMethodsCalled() { _mock.expectVoid("noArgs", Mock.NO_ARGS); assertFails("verify did not fail when not all of the expected methods were called", new Runnable() { public void run() { _mock.verify(); } }); } public void testCalledExpectationClearedBySubsequentExpecation() { _mock.expectVoid( "noArgs", Mock.NO_ARGS ); _interface.noArgs(); _mock.expectVoid( "noArgs", Mock.NO_ARGS ); assertFails("verify did not fail when not all of the expected methods were called", new Runnable() { public void run() { _mock.verify(); } }); } public void testUnexpectedMethodThrowsWhenStrict() { _mock.setStrict(true); assertFails("strict mock did not fail when unexpected method was called", new Runnable() { public void run() { _interface.voidMethod();} }); } public void testUnexpectedMethodDoesNotThrowWhenNotStrict() { try { _interface.voidMethod(); } catch( AssertionFailedError ex ) { fail( "unstrict mock failed when unexpected method was called" ); } } public void testDefaultResultFromUnexpectedCalls() { assertEquals( false, _interface.booleanResult() ); assertEquals( 0, _interface.byteResult() ); assertEquals( '\0', _interface.charResult() ); assertEquals( 0, _interface.shortResult() ); assertEquals( 0, _interface.intResult() ); assertEquals( 0L, _interface.longResult() ); assertEquals( 0.0f, _interface.floatResult(), 0.0f ); assertEquals( 0.0d, _interface.doubleResult(), 0.0d ); assertEquals( "", _interface.stringResult() ); } public void testSetupDefaultResult() { _mock.setupDefaultResult( boolean.class, new Boolean(true) ); _mock.setupDefaultResult( byte.class, new Byte((byte)1) ); _mock.setupDefaultResult( char.class, new Character( '2' ) ); _mock.setupDefaultResult( short.class, new Short( (short)3 ) ); _mock.setupDefaultResult( int.class, new Integer(4) ); _mock.setupDefaultResult( long.class, new Long(5L) ); _mock.setupDefaultResult( float.class, new Float(6.0f) ); _mock.setupDefaultResult( double.class, new Double(7.0d) ); _mock.setupDefaultResult( String.class, "8" ); assertEquals( true, _interface.booleanResult() ); assertEquals( (byte)1, _interface.byteResult() ); assertEquals( '2', _interface.charResult() ); assertEquals( 3, _interface.shortResult() ); assertEquals( 4, _interface.intResult() ); assertEquals( 5L, _interface.longResult() ); assertEquals( 6.0f, _interface.floatResult(), 0.0f ); assertEquals( 7.0d, _interface.doubleResult(), 0.0d ); assertEquals( "8", _interface.stringResult() ); } public void testWrongNumberOfArguments() { Predicate p = new IsEqual( new Integer(2) ); Predicate q = new IsAnything(); _mock.expectReturn( "objectTypes", new Predicate[]{p,q}, "2" ); assertFails( "mock did not fail when wrong number of arguments passed", new Runnable() { public void run() { _interface.objectTypes( new Integer(1) ); } }); } public void testArgumentsPassedToNoArgMethod() { Predicate p = new IsAnything(); _mock.expectVoid( "voidMethod", new Predicate[]{p} ); try { _interface.voidMethod(); } catch( AssertionFailedError ex ) { return; } fail( "mock did not fail when arguments passed to void method" ); } public void testPredicateFailure() { Predicate p = new IsEqual( new Integer(2) ); _mock.expectReturn( "objectTypes", new Predicate[]{p}, "2" ); assertTrue( !p.eval( new Integer(1) ) ); try { _interface.objectTypes( new Integer(1) ); } catch( AssertionFailedError ex ) { return; } fail( "mock did not fail when predicate returned false" ); } public void testErrorWhenOrderedMethodsCalledInWrongOrder() { _mock.expectVoid( "first", Mock.NO_ARGS ); _mock.expectVoid( "second", Mock.NO_ARGS ); _mock.order( "first", "second" ); try { _interface.second(); } catch( AssertionFailedError ex ) { return; } fail( "mock did not enforce order of calls" ); } public void testExpectNotCalled() { _mock.expectNotCalled("noArgs"); try { _interface.noArgs(); } catch( AssertionFailedError ex ) { return; } fail("AssertionFailedError expected"); } public void testExpectNotCalledClearedBySubsequentExpectation() { _mock.expectNotCalled("noArgs"); _mock.expectVoid( "noArgs", Mock.NO_ARGS ); _interface.noArgs(); _mock.verify(); } public void testSetupResult() { final String RESULT = "result"; _mock.setupResult( "objectTypes", RESULT ); assertEquals( RESULT, _interface.objectTypes(null) ); assertEquals( RESULT, _interface.objectTypes(new Integer(0)) ); _mock.verify(); } public void testSetupThrow() { _mock.setupThrow( "objectTypes", new IllegalArgumentException() ); try { _interface.objectTypes(null); fail("expected IllegalArgumentException"); } catch( IllegalArgumentException ex ) { // expected } try { _interface.objectTypes(new Integer(0)); fail("expected IllegalArgumentException"); } catch( IllegalArgumentException ex ) { // expected } _mock.verify(); } public void testSetupCallWithSideEffect() { final StringBuffer buf = new StringBuffer(); _mock.setup( new ExpectedCall("sideEffect") { public Object eval( Object[] args ) throws Throwable { buf.append("hello"); return Mock.VOID; } } ); _interface.sideEffect( buf ); assertEquals( "hello", buf.toString() ); _mock.verify(); } public void testSetupResultDoesNotRequireCall() { _mock.setupResult( "objectTypes", "result" ); _mock.verify(); } public void testSetupThrowDoesNotRequireCall() { _mock.setupThrow( "objectTypes", new RuntimeException() ); _mock.verify(); } public void testSetupCallWithSideEffectDoesNotRequireCall() { _mock.setup( new ExpectedCall("sideEffect") { public Object eval( Object[] args ) throws Throwable { throw new RuntimeException("should not be called"); } } ); _mock.verify(); } public void testNoErrorWhenOrderedMethodsCalledInCorrectOrder() { _mock.expectVoid( "first", Mock.NO_ARGS ); _mock.expectVoid( "second", Mock.NO_ARGS ); _mock.order( "first", "second" ); _interface.first(); _interface.second(); } public void testErrorWhenMockedVoidMethodReturnsAValue() { _mock.expectReturn( "voidMethod", Mock.NO_ARGS, Boolean.TRUE ); try { _interface.voidMethod(); } catch( AssertionFailedError ex ) { return; } fail("should have thrown AssertionFailedError when return from void method"); } public void testDerivedMockClass() { DerivedMock mock = new DerivedMock("Derived"); ExampleInterface i = (ExampleInterface)Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{ ExampleInterface.class }, mock ); i.voidMethod(); assertTrue( "mock method not called on derived class", mock.was_called ); mock.verify(); } public void testDerivedClassPassingInvocationToMockCall() { DerivedMock mock = new DerivedMock("Derived"); ExampleInterface i = (ExampleInterface)Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{ ExampleInterface.class }, mock ); mock.expectReturn( "objectTypes", new Predicate[] { new IsAnything() }, "result" ); assertEquals( "result", i.objectTypes( new Integer(1) ) ); mock.verify(); } } --- Test_Mock.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-10-25 22:07:02
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv31206/src/core/com/mockobjects/dynamic Modified Files: Mock.java Log Message: cleaned up createInterface() added getTrainer() Index: Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Mock.java 25 Oct 2002 20:59:41 -0000 1.2 +++ Mock.java 25 Oct 2002 22:06:59 -0000 1.3 @@ -413,17 +413,17 @@ } public Object createInterface( Class interface_class ) { - return createInterface( interface_class.getClassLoader(), - new Class[]{ interface_class } ); + return createInterface(interface_class, this); } - - public Object createInterface( ClassLoader loader, Class interface_class ) { - return createInterface( loader, new Class[]{ interface_class } ); + + public Object getTrainer( Class interfaceClass ) { + return createInterface(interfaceClass, new Trainer( this )); } - - public Object createInterface( ClassLoader loader, - Class[] interface_classes ) - { - return Proxy.newProxyInstance( loader, interface_classes, this ); + + private Object createInterface(Class interface_class, InvocationHandler handler) { + return Proxy.newProxyInstance( interface_class.getClassLoader(), + new Class[]{ interface_class }, + handler ); } + } |
From: Steve F. <sm...@us...> - 2002-10-25 22:06:12
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util In directory usw-pr-cvs1:/tmp/cvs-serv30920/src/core/com/mockobjects/util Modified Files: TestCaseMo.java AssertMo.java Log Message: added assertFails() with tests Index: TestCaseMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/TestCaseMo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestCaseMo.java 29 Jul 2001 19:50:24 -0000 1.1 +++ TestCaseMo.java 25 Oct 2002 22:06:08 -0000 1.2 @@ -19,6 +19,10 @@ AssertMo.assertVerifyFails(aVerifiable); } + public void assertFails(String message, Runnable runnable) { + AssertMo.assertFails(message, runnable); + } + public static void start(String[] testNames) { TestRunner.main(testNames); } Index: AssertMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/util/AssertMo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AssertMo.java 29 Jul 2001 19:50:24 -0000 1.1 +++ AssertMo.java 25 Oct 2002 22:06:09 -0000 1.2 @@ -90,4 +90,13 @@ public static void notImplemented(String mockName) { throw new NotImplementedException("Not Implemented in " + mockName); } + + public static void assertFails(String message, Runnable runnable) { + try { + runnable.run(); + } catch (AssertionFailedError expected) { + return; + } + fail(message); + } } |
From: Steve F. <sm...@us...> - 2002-10-25 22:06:11
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects In directory usw-pr-cvs1:/tmp/cvs-serv30920/src/core/test/mockobjects Modified Files: TestAssertMo.java Log Message: added assertFails() with tests Index: TestAssertMo.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/TestAssertMo.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestAssertMo.java 21 Oct 2002 22:52:38 -0000 1.1 +++ TestAssertMo.java 25 Oct 2002 22:06:07 -0000 1.2 @@ -153,4 +153,22 @@ anExpectedArray, anActualArray); } + + public void testFailureCheckerWithFailure() { + AssertMo.assertFails("Test Description", + new Runnable() { + public void run() { fail("Should not be propagated"); } + }); + } + + public void testFailureCheckerWithoutFailure() { + final String TEST_MESSAGE = "Test Description"; + try { + AssertMo.assertFails(TEST_MESSAGE, new Runnable() { public void run() {} }); + } catch (AssertionFailedError expected) { + assertEquals(TEST_MESSAGE, expected.getMessage()); + return; + } + fail("Should have thrown an exception"); + } } |
From: Steve F. <sm...@us...> - 2002-10-25 22:05:27
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv30622/src/core/test/mockobjects/dynamic Added Files: PredicatesTest.java Removed Files: Test_Predicates.java Log Message: rename from Test_Predicates to PredicatesTest --- NEW FILE: PredicatesTest.java --- /* Copyright (c) 2002 Nat Pryce. All rights reserved. * * Created on February 10, 2002, 11:24 PM */ package test.mockobjects.dynamic; import com.mockobjects.dynamic.*; import java.util.EventObject; public class PredicatesTest extends junit.framework.TestCase { class True implements Predicate { public boolean eval( Object o ) { return true; } } class False implements Predicate { public boolean eval( Object o ) { return false; } } /** Creates a new instance of Test_Predicates */ public PredicatesTest( String test ) { super(test); } public void testIsNull() { Predicate p = new IsNull(); assertTrue( p.eval(null) ); assertTrue( !p.eval(new Object()) ); } public void testIsSame() { Object o1 = new Object(); Object o2 = new Object(); Predicate p = new IsSame(o1); assertTrue( p.eval(o1) ); assertTrue( !p.eval(o2) ); } public void testIsEqual() { Integer i1 = new Integer(1); Integer i2 = new Integer(2); Predicate p = new IsEqual(i1); assertTrue( p.eval(i1) ); assertTrue( p.eval( new Integer(1) ) ); assertTrue( !p.eval(i2) ); } public void testIsGreaterThan() { Predicate p = new IsGreaterThan( new Integer(1) ); assertTrue( !p.eval( new Integer(0) ) ); assertTrue( !p.eval( new Integer(1) ) ); assertTrue( p.eval( new Integer(2) ) ); } public void testIsLessThan() { Predicate p = new IsLessThan( new Integer(1) ); assertTrue( p.eval( new Integer(0) ) ); assertTrue( !p.eval( new Integer(1) ) ); assertTrue( !p.eval( new Integer(2) ) ); } public void testIsAnything() { Predicate p = new IsAnything(); assertTrue( p.eval(null) ); assertTrue( p.eval( new Object() ) ); } public void testIsInstanceOf() { Predicate p = new IsInstanceOf( Number.class ); assertTrue( p.eval( new Integer(1) ) ); assertTrue( p.eval( new Double(1.0) ) ); assertTrue( !p.eval("a string") ); assertTrue( !p.eval(null) ); } public void testIsNot() { Predicate p = new IsNot( new True() ); assertTrue( !p.eval(null) ); assertTrue( !p.eval( new Object() ) ); } public void testAnd() { Object o = new Object(); assertTrue( new And( new True(), new True() ).eval(o) ); assertTrue( !new And( new False(), new True() ).eval(o) ); assertTrue( !new And( new True(), new False() ).eval(o) ); assertTrue( !new And( new False(), new False() ).eval(o) ); } public void testOr() { Object o = new Object(); assertTrue( new Or( new True(), new True() ).eval(o) ); assertTrue( new Or( new False(), new True() ).eval(o) ); assertTrue( new Or( new True(), new False() ).eval(o) ); assertTrue( !new Or( new False(), new False() ).eval(o) ); } public void testIsEventFrom() { Object o = new Object(); EventObject ev = new EventObject(o); EventObject ev2 = new EventObject( new Object() ); Predicate p = new IsEventFrom(o); assertTrue( p.eval(ev) ); assertTrue( "p should eval to false for an event not from o", !p.eval(ev2) ); assertTrue( "p should eval to false for objects that are not events", !p.eval(o) ); } private static class DerivedEvent extends EventObject { public DerivedEvent( Object source ) { super(source); } } public void testIsEventSubtypeFrom() { Object o = new Object(); DerivedEvent good_ev = new DerivedEvent(o); DerivedEvent wrong_source = new DerivedEvent(new Object()); EventObject wrong_type = new EventObject(o); EventObject wrong_source_and_type = new EventObject(new Object()); Predicate p = new IsEventFrom( DerivedEvent.class, o ); assertTrue( p.eval(good_ev) ); assertTrue( "p should eval to false for an event not from o", !p.eval(wrong_source) ); assertTrue( "p should eval to false for an event of the wrong type", !p.eval(wrong_type) ); assertTrue( "p should eval to false for an event of the wrong type "+ "and from the wrong source", !p.eval(wrong_source_and_type) ); } public void testIsCloseTo() { Predicate p = new IsCloseTo( 1.0, 0.5 ); assertTrue( p.eval( new Double(1.0) ) ); assertTrue( p.eval( new Double(0.5) ) ); assertTrue( p.eval( new Double(1.5) ) ); assertTrue( p.eval( new Float(1.0) ) ); assertTrue( p.eval( new Integer(1) ) ); assertTrue( "number too large", !p.eval( new Double(2.0) ) ); assertTrue( "number too small", !p.eval( new Double(0.0) ) ); try { p.eval("wrong type"); fail("ClassCastException expected for wrong type of argument"); } catch( ClassCastException ex ) { // expected } } } --- Test_Predicates.java DELETED --- |
From: Steve F. <sm...@us...> - 2002-10-25 21:06:32
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv5610/src/core/com/mockobjects/dynamic Modified Files: P.java Log Message: added more versions of args() all called the same for consistency Index: P.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/P.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- P.java 22 Oct 2002 23:11:13 -0000 1.2 +++ P.java 25 Oct 2002 21:06:28 -0000 1.3 @@ -89,8 +89,12 @@ /* Helper methods for succinctly constructing Predicate arrays */ - - public static Predicate[] arg(Predicate p) { + + public static Predicate[] args() { + return Mock.NO_ARGS; + } + + public static Predicate[] args(Predicate p) { return new Predicate[] {p}; } |
From: Steve F. <sm...@us...> - 2002-10-25 21:03:07
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv3816/src/core/test/mockobjects/dynamic Modified Files: Test_Mock.java Log Message: added test against returning values from void methods fixed VOID failures in CallWithSideEffects tests renamed tests for consistency Index: Test_Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/test/mockobjects/dynamic/Test_Mock.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Test_Mock.java 21 Oct 2002 22:52:38 -0000 1.1 +++ Test_Mock.java 25 Oct 2002 21:03:03 -0000 1.2 @@ -152,7 +152,7 @@ _mock.verify(); } - public void testExpectCallWithSideEffects() { + public void testExpectCallWithSideEffect() { final StringBuffer buf = new StringBuffer(); _mock.expect( new ExpectedCall( "sideEffect", @@ -160,7 +160,7 @@ { public Object eval( Object[] args ) throws Throwable { buf.append("hello"); - return null; + return Mock.VOID; } } ); @@ -375,7 +375,7 @@ _mock.setup( new ExpectedCall("sideEffect") { public Object eval( Object[] args ) throws Throwable { buf.append("hello"); - return null; + return Mock.VOID; } } ); @@ -413,7 +413,19 @@ _interface.first(); _interface.second(); } - + + public void testErrorWhenMockedVoidMethodReturnsAValue() { + _mock.expectReturn( "voidMethod", Mock.NO_ARGS, Boolean.TRUE ); + + try { + _interface.voidMethod(); + } + catch( AssertionFailedError ex ) { + return; + } + fail("should have thrown AssertionFailedError when return from void method"); + } + public void testDerivedMockClass() { DerivedMock mock = new DerivedMock("Derived"); ExampleInterface i = (ExampleInterface)Proxy.newProxyInstance( |
From: Steve F. <sm...@us...> - 2002-10-25 20:59:46
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv2214/src/core/com/mockobjects/dynamic Modified Files: Mock.java Log Message: added check against returning values from void methods removed duplication in overloaded expect methods tidied up some formatting Index: Mock.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Mock.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Mock.java 21 Oct 2002 22:51:26 -0000 1.1 +++ Mock.java 25 Oct 2002 20:59:41 -0000 1.2 @@ -4,33 +4,26 @@ */ package com.mockobjects.dynamic; +import com.mockobjects.Verifiable; +import junit.framework.Assert; import junit.framework.AssertionFailedError; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.util.Set; - -import com.mockobjects.dynamic.ExpectedCall; -import com.mockobjects.dynamic.ExpectedReturn; -import com.mockobjects.dynamic.ExpectedThrow; -import com.mockobjects.Verifiable; +import java.util.*; /** A convenient class for creating simple * <a href="http://www.mockobjects.com">mock objects</a>. */ public class Mock - extends junit.framework.Assert + extends Assert implements InvocationHandler, Verifiable { - /** A convenient constant for defining expectations for methods that + public static final Object VOID = new Object(); + + /** A convenient constant for defining expectations for methods that * have no methods. */ public static final Predicate[] NO_ARGS = new Predicate[0]; @@ -187,7 +180,7 @@ * before being returned to the caller of the method. */ public void expectReturn( String method, Object arg, Object result ) { - expect( new ExpectedReturn( method, P.arg(P.same(arg)), result ) ); + expectReturn(method, P.args(P.eq(arg)), result); } /** Expect a method call with no parameters and return a result when it is called. @@ -200,7 +193,7 @@ * before being returned to the caller of the method. */ public void expectReturn( String method, Object result ) { - expect( new ExpectedReturn( method, null, result ) ); + expectReturn(method, NO_ARGS, result ); } /** Expect a call to a method with a void return type. @@ -213,7 +206,7 @@ * the expected arity of the method call. */ public void expectVoid( String method, Predicate[] args ) { - expect( new ExpectedReturn( method, args, null ) ); + expect( new ExpectedReturn( method, args, VOID ) ); } /** Expect a call to a method with a void return type. @@ -224,7 +217,7 @@ * An single object that will be compared with predicate same() */ public void expectVoid(String method, Object arg) { - expect(new ExpectedReturn(method, P.arg(P.same(arg)), null)); + expectVoid(method, P.args(P.eq(arg))); } /** Expect a call to a method with a void return type and no parameters @@ -233,7 +226,7 @@ * The name of the method that will be called. */ public void expectVoid(String method) { - expect(new ExpectedReturn(method, null, null)); + expectVoid(method, NO_ARGS); } /** Expect a method call and throw an exception or error when it is called. @@ -247,9 +240,7 @@ * @param exception * The exception or error that will be thrown as a result of this call. */ - public void expectThrow( String method, Predicate[] args, - Throwable exception ) - { + public void expectThrow( String method, Predicate[] args, Throwable exception ) { expect( new ExpectedThrow( method, args, exception ) ); } @@ -262,9 +253,8 @@ * @param exception * The exception or error that will be thrown as a result of this call. */ - public void expectThrow( String method, Object arg, Throwable exception ) - { - expect( new ExpectedThrow( method, P.arg(P.same(arg)), exception ) ); + public void expectThrow( String method, Object arg, Throwable exception ) { + expectThrow( method, P.args(P.eq(arg)), exception ); } /** Expect a method call with no parameters and throw an exception or error when it is called. @@ -274,9 +264,8 @@ * @param exception * The exception or error that will be thrown as a result of this call. */ - public void expectThrow( String method, Throwable exception ) - { - expect( new ExpectedThrow( method, null, exception ) ); + public void expectThrow( String method, Throwable exception ) { + expectThrow( method, NO_ARGS, exception ); } /** Expect a method not to be called. @@ -317,8 +306,7 @@ try { return getClass().getMethod( - method.getName(), method.getParameterTypes() ).invoke( this, - args ); + method.getName(), method.getParameterTypes() ).invoke( this, args ); } catch( NoSuchMethodException ex ) { return mockCall( method, args ); @@ -339,8 +327,9 @@ if( expected.isTestingArguments() ) { checkArguments( expected, args ); } - return expected.eval( args ); - + + return checkResult(method, expected.eval( args )); + } else if( _strict ) { throw new AssertionFailedError( _name + ": unexpected call to " + method_name ); @@ -348,7 +337,15 @@ return defaultResult( method.getReturnType() ); } } - + + private Object checkResult(Method method, Object result) { + if( method.getReturnType() == void.class && VOID != result ) { + fail("trying to return " + result + " from void method"); + } + + return result; + } + private void checkCallOrder( String method_name ) { if( _order_constraints.containsKey(method_name) ) { assertMethodsHaveBeenCalled( |
From: Steve F. <sm...@us...> - 2002-10-22 23:11:16
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv18068/src/core/com/mockobjects/dynamic Modified Files: P.java Log Message: added IS_NOT_NULL Index: P.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/P.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- P.java 21 Oct 2002 22:51:26 -0000 1.1 +++ P.java 22 Oct 2002 23:11:13 -0000 1.2 @@ -12,6 +12,7 @@ { public static final IsAnything IS_ANYTHING = new IsAnything(); public static final IsNull IS_NULL = new IsNull(); + public static final Predicate IS_NOT_NULL = not(IS_NULL); public static final Predicate IS_TRUE = new IsEqual(new Boolean(true)); public static final Predicate IS_FALSE = eq(new Boolean(false)); public static final Predicate IS_ZERO = eq(new Integer(0)); |
From: Steve F. <sm...@us...> - 2002-10-22 23:09:40
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv17378 Modified Files: build.xml Log Message: Added mkdirs to junit target Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- build.xml 21 Oct 2002 22:56:19 -0000 1.27 +++ build.xml 22 Oct 2002 23:09:35 -0000 1.28 @@ -179,7 +179,12 @@ <target name="junit" depends="call-me-first, compile-j2ee" - description="run the junit tests"> + description="run the junit tests"> + + <mkdir dir="${core.classes}" /> + <mkdir dir="${jdk.classes}" /> + <mkdir dir="${j2ee.classes}" /> + <junit fork="yes" haltonfailure="yes"> <classpath> <path refid="lib.classpath" /> |
From: Francois B. <fbe...@ft...> - 2002-10-22 16:01:25
|
Hi ! I do not have the J2EE classes installed on my system, and when I try building MockObjects-java, Ant stops at line 183 and gives me an error. To prevent this problem, the j2ee folder should be created. The patch below corrects this problem. Have a nice day ! Francois Beausoleil Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.27 diff -u -r1.27 build.xml --- build.xml 21 Oct 2002 22:56:19 -0000 1.27 +++ build.xml 22 Oct 2002 15:57:17 -0000 @@ -180,6 +180,10 @@ <target name="junit" depends="call-me-first, compile-j2ee" description="run the junit tests"> + <mkdir dir="${core.classes}" /> + <mkdir dir="${jdk.classes}" /> + <mkdir dir="${j2ee.classes}" /> + <junit fork="yes" haltonfailure="yes"> <classpath> <path refid="lib.classpath" /> -- http://fastmail.fm - The professional email service |
From: Nat P. <np...@us...> - 2002-10-22 13:01:02
|
Update of /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv638/src/core/com/mockobjects/dynamic Modified Files: And.java Or.java Log Message: Fixed errata and added more documentation to javadoc comments. Index: And.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/And.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- And.java 21 Oct 2002 22:51:26 -0000 1.1 +++ And.java 22 Oct 2002 13:00:58 -0000 1.2 @@ -5,6 +5,8 @@ package com.mockobjects.dynamic; /** Calculates the logical conjunction of two predicates. + * Evaluation is shortcut, so that the second predicate is not called + * if the first predicate returns <code>false</code>. */ public class And implements Predicate Index: Or.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/core/com/mockobjects/dynamic/Or.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Or.java 21 Oct 2002 22:51:26 -0000 1.1 +++ Or.java 22 Oct 2002 13:00:58 -0000 1.2 @@ -5,6 +5,8 @@ package com.mockobjects.dynamic; /** Calculates the logical disjunction of two predicates. + * Evaluation is shortcut, so that the second predicate is not called + * if the first predicate returns <code>true</code>. */ public class Or implements Predicate |
From: Nat P. <np...@us...> - 2002-10-22 13:01:02
|
Update of /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com/mockobjects/dynamic In directory usw-pr-cvs1:/tmp/cvs-serv638/src/jdk/1.4/com/mockobjects/dynamic Modified Files: Matches.java Log Message: Fixed errata and added more documentation to javadoc comments. Index: Matches.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/jdk/1.4/com/mockobjects/dynamic/Matches.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Matches.java 21 Oct 2002 22:55:08 -0000 1.1 +++ Matches.java 22 Oct 2002 13:00:58 -0000 1.2 @@ -15,8 +15,16 @@ private Pattern _pattern; private Matcher _matcher; - /** Creates a new instance of IsEqual - */ + /** Creates a new Matches predicate. + * + * @param regex + * A regular expression string used to create a + * {@link java.util.regex.Pattern}. The {@link #eval} method + * returns true when applied to Strings that match this pattern. + * Matching is tested by calling the + * {@link java.util.regex.Matcher#matches} method of a + * {@link java.util.regex.Matcher} object. + */ public Matches( String regex ) { _pattern = Pattern.compile(regex); } |
From: Tim M. <tim...@po...> - 2002-10-21 23:59:18
|
Don't speak so soon - the one in eclipse is pretty poor... I had high hopes too until I used it this morning and it hardly did anything. That said - it probably doesn't belong in the mock objects build... I've also been experimenting with rebuilding the junit plugin with the MO assert methods built into it - if I can get used to this cvs stuff and how to submit things I'll see about getting them rolled into junit. Tim -----Original Message----- From: moc...@li... [mailto:moc...@li...]On Behalf Of Steve Freeman Sent: 21 October 2002 21:29 To: mockobjects users; MockObjects Subject: [MO-java-dev] SuiteBuilder? Is anyone still using SuiteBuilder to assemble JUnit tests? It strikes me that JUnit is much improved in this area and we could do away with it. Steve ------------------------------------------------------- This sf.net emial is sponsored by: Influence the future of Java(TM) technology. Join the Java Community Process(SM) (JCP(SM)) program now. http://ad.doubleclick.net/clk;4699841;7576298;k?http://www.sun.com/javavote _______________________________________________ Mockobjects-java-dev mailing list Moc...@li... https://lists.sourceforge.net/lists/listinfo/mockobjects-java-dev --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.404 / Virus Database: 228 - Release Date: 15/10/2002 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.404 / Virus Database: 228 - Release Date: 15/10/2002 |
From: Steve F. <sm...@us...> - 2002-10-21 22:56:22
|
Update of /cvsroot/mockobjects/mockobjects-java In directory usw-pr-cvs1:/tmp/cvs-serv16265 Modified Files: build.xml Log Message: version to 0.6 reorganised tests Index: build.xml =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- build.xml 15 Oct 2002 13:53:11 -0000 1.26 +++ build.xml 21 Oct 2002 22:56:19 -0000 1.27 @@ -18,7 +18,7 @@ <target name="project-properties"> <property name="project.fullname" value="Mock Objects" /> - <property name="project.version" value="0.5" /> + <property name="project.version" value="0.6" /> <property name="project.name" value="mockobjects" /> <property name="year" value="2002" /> <property name="debug" value="on" /> @@ -41,7 +41,8 @@ <property name="j2ee.lib" value="lib/j2ee.jar" /> </target> - <target name="deliverable-names" depends="project-properties"> + <target name="deliverable-names" + depends="project-properties"> <property name="dist.dir" value="dist" /> <property name="jar.base.name" value="mockobjects-${project.version}" /> <property name="alt.jar.base.name" value="alt-${project.version}" /> @@ -57,7 +58,8 @@ </patternset> </target> - <target name="check-availabilities" depends="source-locations"> + <target name="check-availabilities" + depends="source-locations"> <path id="lib.classpath"> <fileset dir="${lib.dir}"> <include name="*.jar" /> @@ -92,8 +94,7 @@ <tstamp /> - <echo - message="--------- ${project.fullname} ${project.version} ---------" /> + <echo message="--------- ${project.fullname} ${project.version} ---------" /> <echo message="" /> <echo message="java.class.path = ${java.class.path}" /> <echo message="" /> @@ -114,48 +115,32 @@ <mkdir dir="${flush.dir}" /> </target> - <target name="compile-core" depends="call-me-first" - description="Compile mock objects core"> + <target name="compile-core" + depends="call-me-first" + description="Compile mock objects core"> <mkdir dir="${core.classes}" /> - <javac destdir="${core.classes}" debug="${debug}" - deprecation="${deprecation}" verbose="false" - optimize="${optimize}" srcdir="${src.core.dir}"> - <exclude name="com/mockobjects/test/**" /> - - <classpath> - <path refid="lib.classpath" /> - <pathelement path="${java.class.path}" /> - </classpath> - </javac> - </target> - - <target name="compile-test" depends="call-me-first, compile-j2ee" - description="Compile mock objects core"> - - <mkdir dir="${core.classes}" /> - - <javac destdir="${core.classes}" debug="${debug}" - deprecation="${deprecation}" verbose="false" - optimize="${optimize}" srcdir="${src.core.dir}"> - <include name="com/mockobjects/test/**" /> + <javac destdir="${core.classes}" + debug="${debug}" + verbose="false" + optimize="${optimize}" + srcdir="${src.core.dir}"> <classpath> <path refid="lib.classpath" /> <pathelement path="${java.class.path}" /> - <pathelement path="${jdk.classes}" /> - <pathelement path="${java.class.path}" /> </classpath> </javac> </target> - <target name="compile-jdk" depends="compile-core" - description="Compile all the java files for included libraries"> + <target name="compile-jdk" + depends="compile-core" + description="Compile all the java files for included libraries"> <mkdir dir="${jdk.classes}" /> <javac destdir="${jdk.classes}" debug="${debug}" - deprecation="${deprecation}" verbose="false" - optimize="${optimize}"> + verbose="false" + optimize="${optimize}"> <src path="${src.jdk.dir}/${jdk.version}" /> <src path="${src.jdk.dir}/common" /> @@ -167,8 +152,10 @@ </javac> </target> - <target name="compile-j2ee" depends="compile-jdk" if="j2ee.version" - description="Compile all the java files for included libraries"> + <target name="compile-j2ee" + depends="compile-jdk" + if="j2ee.version" + description="Compile all the java files for included libraries"> <mkdir dir="${j2ee.classes}" /> @@ -190,59 +177,65 @@ </javac> </target> - <target name="compile-ext-httpclient" depends="compile-jdk" if="httpclient" - description="Compile all the java files for included libraries"> - - <mkdir dir="${httpclient.classes}" /> - - <javac destdir="${httpclient.classes}" debug="${debug}" - deprecation="${deprecation}" verbose="false" - optimize="${optimize}"> - - <src path="${src.httpclient.dir}"/> - <include name="com/mockobjects/apache/**"/> - <include name="alt/org/apache/**"/> - - <classpath> - <path refid="lib.classpath" /> - <pathelement path="${java.class.path}" /> - <pathelement path="${core.classes}" /> - <pathelement path="${jdk.classes}" /> - </classpath> - </javac> - </target> - - <target name="test" depends="call-me-first, compile-test" - description="run the junit tests"> + <target name="junit" + depends="call-me-first, compile-j2ee" + description="run the junit tests"> <junit fork="yes" haltonfailure="yes"> <classpath> <path refid="lib.classpath" /> - + <pathelement location="${j2ee.classes}" /> <pathelement location="${jdk.classes}" /> - <pathelement location="${core.classes}" /> - <pathelement path="${java.class.path}" /> </classpath> <formatter type="plain" usefile="false" /> <batchtest> - <fileset dir="${jdk.classes}"> - <include name="**/*Test.class" /> - - <include name="**/AllTests.class" /> + <fileset dir="${core.classes}"> + <include name="test/**Test*.class" /> + <exclude name="test/**Test*$*.class" /> + <exclude name="**/AllTests.class" /> </fileset> - <fileset dir="${core.classes}"> - <include name="**/*Test.class" /> + <fileset dir="${jdk.classes}"> + <include name="test/**Test*.class" /> + <exclude name="test/**Test*$*.class" /> + <exclude name="**/AllTests.class" /> + </fileset> - <include name="**/AllTests.class" /> + <fileset dir="${j2ee.classes}"> + <include name="test/**Test*.class" /> + <exclude name="test/**Test*$*.class" /> + <exclude name="**/AllTests.class" /> </fileset> </batchtest> </junit> </target> + <target name="compile-ext-httpclient" + depends="compile-jdk" + if="httpclient" + description="Compile all the java files for included libraries"> + <mkdir dir="${httpclient.classes}" /> + + <javac destdir="${httpclient.classes}" debug="${debug}" + deprecation="${deprecation}" verbose="false" + optimize="${optimize}"> + + <src path="${src.httpclient.dir}"/> + <include name="com/mockobjects/apache/**"/> + <include name="alt/org/apache/**"/> + + <classpath> + <path refid="lib.classpath" /> + <pathelement path="${java.class.path}" /> + <pathelement path="${core.classes}" /> + <pathelement path="${jdk.classes}" /> + </classpath> + </javac> + </target> + <target name="copy-nonjava-files" depends="source-locations, check-availabilities, call-me-first"> </target> @@ -251,54 +244,63 @@ depends="jar-core, jar-jdk, jar-j2ee"/> <target name="jar-core" - depends="deliverable-names, test" + depends="deliverable-names, junit" description="Generate core mockobjects jar"> <jar jarfile="${out.dir}/${jar.base.name}-core.jar" manifest="${conf.dir}/manifest"> - <fileset dir="${core.classes}" /> + <fileset dir="${core.classes}"> + <exclude name="test/**"/> + </fileset> </jar> </target> <target name="jar-jdk" - depends="deliverable-names, test" + depends="deliverable-names, junit" description="Generate jdk mockobjects jar"> <antcall target="_inner-jar"> - <param name="jarfile.name" value="${out.dir}/${jar.base.name}-jdk${jdk.version}.jar" /> - <param name="alt.jarfile.name" value="${out.dir}/${alt.jar.base.name}-jdk${jdk.version}.jar" /> + <param name="jarfile.name" + value="${out.dir}/${jar.base.name}-jdk${jdk.version}.jar" /> + <param name="alt.jarfile.name" + value="${out.dir}/${alt.jar.base.name}-jdk${jdk.version}.jar" /> <param name="classes.dir" value="${jdk.classes}" /> </antcall> </target> <target name="jar-j2ee" - depends="deliverable-names, test" + depends="deliverable-names, junit" if="j2ee.version" description="Generate j2ee mockobjects jar"> <antcall target="_inner-jar"> - <param name="jarfile.name" value="${out.dir}/${jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> - <param name="alt.jarfile.name" value="${out.dir}/${alt.jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> + <param name="jarfile.name" + value="${out.dir}/${jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> + <param name="alt.jarfile.name" + value="${out.dir}/${alt.jar.base.name}-j${jdk.version}-j2ee${j2ee.version}.jar" /> <param name="classes.dir" value="${j2ee.classes}" /> </antcall> </target> <target name="_inner-jar" - depends="deliverable-names, test" > + depends="deliverable-names, junit" > <!-- requires jarfile.name, alt.jarfile.name, classes.dir --> <jar jarfile="${jarfile.name}" manifest="${conf.dir}/manifest"> <fileset dir="${classes.dir}"> <exclude name="alt/**"/> + <exclude name="test/**"/> </fileset> </jar> <jar jarfile="${alt.jarfile.name}" manifest="${conf.dir}/manifest"> <fileset dir="${classes.dir}"> <include name="alt/**"/> + <exclude name="test/**"/> </fileset> </jar> </target> - <target name="jar-ext-httpclient" depends="test, compile-ext-httpclient" - description="Generate extention mockobjects jar"> + <target name="jar-ext-httpclient" + depends="junit, compile-ext-httpclient" + description="Generate extension mockobjects jar"> <jar jarfile="${out.dir}/mockobjects-httpclient.jar" manifest="${conf.dir}/manifest"> <fileset dir="${httpclient.classes}"> @@ -314,15 +316,16 @@ </target> <target name="javadoc" - depends="call-me-first, deliverable-names" - unless="javadoc.notrequired" - description="Generate the javadoc for the current version"> - <javadoc - packagenames="com.mockobjects.*,alt.*" destdir="${out.javadoc.dir}" - author="true" public="true" version="true" use="true" - windowtitle="${project.fullname} ${project.version}" - doctitle="${project.fullname} ${project.version}" - bottom="Copyright &copy; ${year} Mock Objects. All Rights Reserved."> + depends="call-me-first, deliverable-names" + unless="javadoc.notrequired" + description="Generate the javadoc for the current version"> + <javadoc packagenames="com.mockobjects.*,alt.*" + destdir="${out.javadoc.dir}" + author="true" + public="true" version="true" use="true" + windowtitle="${project.fullname} ${project.version}" + doctitle="${project.fullname} ${project.version}" + bottom="Copyright &copy; ${year} Mock Objects. All Rights Reserved."> <classpath> <path refid="lib.classpath" /> @@ -344,7 +347,7 @@ </group> <group title="Utils" packages="com.mockobjects.util"/> <group title="Alternative" packages="alt.*"/> - <group title="Tests" packages="com.mockobjects.test"/> + <group title="Tests" packages="test.mockobjects"/> </javadoc> </target> @@ -523,8 +526,8 @@ ======================================================================== --> <target name="all" - depends="clean, test, jar, doc, dist" - description="do it all (clean, jar, doc, test)"> + depends="clean, junit, jar, doc, dist" + description="do it all (clean, jar, doc, junit, dist)"> </target> <!-- |