Update of /cvsroot/mocklib/mocklib3/input/staging/htmlcode
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv30632/input/staging/htmlcode
Added Files:
behavior_example.html socket_example.html basic_example.html
timer_example2.html listener_example.html
listener_example2.html advanced_example.html
timer_example.html
Log Message:
checking in html changes, and adding new version of emma.
--- NEW FILE: basic_example.html ---
<html>
<body>
<h1>Basic Examples</h1>
<h2>Basic Examples to help get started</h2>
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/basic/TestExample.java.html">
TestExample.java - The tests themselves. To follow the example, read through the javadoc of the class. Then read the TestExample.setUp() methods javadoc and comments, then read the test's javadoc and comments</a></li>
<li><a href="biz/xsoftware/examples/basic/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/basic/CreditAuthorizationSvc.java.html">
CreditAuthorizationSvc.java - A system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/basic/GiftCardAccountSvc.java.html">
GiftCardAccountSvc.java - Another system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/basic/PurchaseException.java.html">
PurchaseException.java - An exception that is part of an api</a></li>
</ul>
</body>
</html>
--- NEW FILE: listener_example2.html ---
<html>
<body>
<h1>Listener Example 2</h1>
<h2>Mocking Listeners</h2>
This is the oppossite of <a href="listener_example.html"/>Listener Example 1</a>. Instead of the legacy system having an addListener method, the system we want to test has an addListener method. This means, we need to mock the listener we pass to the addListener method so we can verify events are fired properly.
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/listener2/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/listener2/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/listener2/UserListener.java.html">
UserListener.java - The listener we are mocking</a></li>
</body>
</html>
--- NEW FILE: timer_example2.html ---
<html>
<body>
<h1>>Timer Example</h1>
<h2>How to test a Timer that goes off in 24 hours in just milliseconds</h2>
This example shows how to make unit test involving a Timer such that you control when the timer goes off.
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/timer2/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/timer2/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/timer2/TimerInterface.java.html">
TimerInterface.java - The timer we are mocking</a></li>
<li><a href="biz/xsoftware/examples/timer2/TimerInterfaceImpl.java.html">
TimerInterfaceImpl.java - The timer used in the real running system</a></li>
</body>
</html>
--- NEW FILE: listener_example.html ---
<html>
<body>
<h1>Listener Example 1</h1>
<h2>Test Implementations of Listeners</h2>
Some of the systems we want to test will add listeners to apis we want to mock. These tests show examples of just that. It shows how to simulate multiple events being fired from a legacy system back into your code and in so doing test the implementation of the listener you added.
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/listener/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/listener/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/listener/LegacySystem.java.html">
LegacySystem.java - A system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/listener/LegacyDisplayListener.java.html">
LegacyDisplayListener.java - A listener that is part of the LegacySystem API</a></li>
</ul>
</body>
</html>
--- NEW FILE: timer_example.html ---
<html>
<body>
<h1>>Basic Examples - Basic Examples to help get started</h1>
This example consists of three example tests on one system. The files for the test and the system are the following....
<ul>
<li><a href="biz/xsoftware/examples/basic/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/basic/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/basic/CreditAuthorizationSvc.java.html">
CreditAuthorizationSvc.java - A system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/basic/GiftCardAccountSvc.java.html">
GiftCardAccountSvc.java - Another system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/basic/PurchaseException.java.html">
PurchaseException.java - An exception that is part of an api</a></li>
</ul>
</body>
</html>
--- NEW FILE: behavior_example.html ---
<html>
<body>
<h1>Adding Behavior Example</h1>
In certain cases, you may need to simulate a system modifying parameters that were passed into it. While it is not good to have a contract like this with params that are used for in/out operations, these do exist. One example is jdk's nio write methods that take a ByteBuffer
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/behavior/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/behavior/TCPSocket.java.html">
TCPSocket.java - The interface we will mock</a></li>
</body>
</html>
--- NEW FILE: socket_example.html ---
<html>
<body>
<h1>Socket Example</h1>
<h2>Example on how to simulate network connection failures</h2>
This example consists of a few tests on one system. Here are the files for this example....
<ul>
<li><a href="biz/xsoftware/examples/socket/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/socket/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/socket/OtherSubsystem.java.html">
OtherSubsystem.java - The timer we are mocking</a></li>
<li><a href="biz/xsoftware/examples/socket/TCPSocket.java.html">
TCPSocket.java - The socket interface we would write</a></li>
<li><a href="biz/xsoftware/examples/socket/TCPSocketImpl.java.html">
TCPSocketImpl.java - What the socket implementation would look like</a></li>
</body>
</html>
--- NEW FILE: advanced_example.html ---
<html>
<body>
<h1>How to return Mocks from Mocks</h1>
This shows How to mock our a more complicated api, and trigger events from one system and make sure
things happen to another system based on those events. It also demonstrates how to return a mock from a mock which is very useful in testing complex apis such as jdk's nio subsystem.
This example consists of three example tests on one system. The files for the test and the system are the following....
<ul>
<li><a href="biz/xsoftware/examples/advanced/TestExample.java.html">
TestExample.java - The tests themselves</a></li>
<li><a href="biz/xsoftware/examples/advanced/SysUnderTest.java.html">
SysUnderTest.java - The system we are testing</a></li>
<li><a href="biz/xsoftware/examples/advanced/TaskRecordService.java.html">
TaskRecordService.java - A system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/advanced/TaskSystemService.java.html">
TaskSystemService.java - Another system we are mocking</a></li>
<li><a href="biz/xsoftware/examples/advanced/User.java.html">
User.java - An interface we will be mocking that TaskRecordService.getUser method returns</a></li>
</ul>
</body>
</html>
|