<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.karljones.com/index.php?action=history&amp;feed=atom&amp;title=Mock_object</id>
		<title>Mock object - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.karljones.com/index.php?action=history&amp;feed=atom&amp;title=Mock_object"/>
		<link rel="alternate" type="text/html" href="http://wiki.karljones.com/index.php?title=Mock_object&amp;action=history"/>
		<updated>2026-10-23T16:53:16Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>http://wiki.karljones.com/index.php?title=Mock_object&amp;diff=19084&amp;oldid=prev</id>
		<title>Karl Jones: Created page with &quot;In object-oriented programming, '''mock objects''' are simulated objects that mimic the behavior of real objects in controlled ways.  == Description ==  A programmer typic...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.karljones.com/index.php?title=Mock_object&amp;diff=19084&amp;oldid=prev"/>
				<updated>2016-10-04T00:59:03Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;In &lt;a href=&quot;/index.php/Object-oriented_programming&quot; title=&quot;Object-oriented programming&quot;&gt;object-oriented programming&lt;/a&gt;, &amp;#039;&amp;#039;&amp;#039;mock objects&amp;#039;&amp;#039;&amp;#039; are simulated objects that mimic the behavior of real objects in controlled ways.  == Description ==  A programmer typic...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[object-oriented programming]], '''mock objects''' are simulated objects that mimic the behavior of real objects in controlled ways.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
A programmer typically creates a mock object to test the behavior of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behavior of a human in vehicle impacts.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
In a [[Unit testing|unit test]], mock objects can simulate the behavior of complex, real objects and are therefore useful when a real object is impractical or impossible to incorporate into a unit test. If an actual object has any of the following characteristics, it may be useful to use a mock object in its place:&lt;br /&gt;
&lt;br /&gt;
* the object supplies non-deterministic results (e.g. the current time or the current temperature);&lt;br /&gt;
* it has states that are difficult to create or reproduce (e.g. a network error);&lt;br /&gt;
* it is slow (e.g. a complete database, which would have to be initialized before the test);&lt;br /&gt;
* it does not yet exist or may change behavior;&lt;br /&gt;
* it would have to include information and methods exclusively for testing purposes (and not for its actual task).&lt;br /&gt;
&lt;br /&gt;
For example, an alarm clock program which causes a bell to ring at a certain time might get the current time from the outside world. To test this, the test must wait until the alarm time to know whether it has rung the bell correctly. If a mock object is used in place of the real object, it can be programmed to provide the bell-ringing time (whether it is actually that time or not) so that the alarm clock program can be tested in isolation.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Abstract method]]&lt;br /&gt;
* [[Dummy code]]&lt;br /&gt;
* [[Hamcrest]]&lt;br /&gt;
* [[Method stub]]&lt;br /&gt;
* [[Test double]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Mock_object Mock object] @ Wikipedia&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Computer programming]]&lt;/div&gt;</summary>
		<author><name>Karl Jones</name></author>	</entry>

	</feed>