You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bu...@apache.org on 2014/04/04 03:17:30 UTC

svn commit: r904814 [1/7] - in /websites/staging/flex/trunk: cgi-bin/ content/ content/css/ content/flexunit/tutorial/css/ content/flexunit/tutorial/flexunit/ content/flexunit/tutorial/scripts/

Author: buildbot
Date: Fri Apr  4 01:17:29 2014
New Revision: 904814

Log:
Staging update by buildbot for flex

Added:
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-10.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-11.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-12.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-13.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-14.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-15.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-16.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-4.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-5.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-6.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-7.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-8.html
    websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-9.html
Removed:
    websites/staging/flex/trunk/content/flexunit/tutorial/css/
    websites/staging/flex/trunk/content/flexunit/tutorial/scripts/
Modified:
    websites/staging/flex/trunk/cgi-bin/   (props changed)
    websites/staging/flex/trunk/content/   (props changed)
    websites/staging/flex/trunk/content/css/fixed-width.css

Propchange: websites/staging/flex/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr  4 01:17:29 2014
@@ -1 +1 @@
-1584489
+1584492

Propchange: websites/staging/flex/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr  4 01:17:29 2014
@@ -1 +1 @@
-1584489
+1584492

Modified: websites/staging/flex/trunk/content/css/fixed-width.css
==============================================================================
--- websites/staging/flex/trunk/content/css/fixed-width.css (original)
+++ websites/staging/flex/trunk/content/css/fixed-width.css Fri Apr  4 01:17:29 2014
@@ -13,7 +13,7 @@
 	ol ol, ol ul { margin-left: 1em; }
 	ul ul li, ul ol li,
 	ol ol li, ol ul li { margin-left: 2em; }
-	li { line-height: 18px; }
+	li { line-height: 18px; list-style-position: inside }
 	ul.large li { line-height: 21px; }
 	li p { line-height: 21px; }
     ul {list-style: circle; }

Added: websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-10.html
==============================================================================
--- websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-10.html (added)
+++ websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-10.html Fri Apr  4 01:17:29 2014
@@ -0,0 +1,975 @@
+<!DOCTYPE html>
+<!--[if IE 7 ]><html class="ie ie7" lang="en"><![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"><![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
+
+<head>
+
+    <meta charset="utf-8">
+    <title>Apache Flex® - Unit 10 - Mock Classes
</title>
+
+    <!-- For Mobiles  -->
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href='https://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
+    <!-- CSS -->
+    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
+    <link rel="stylesheet" type="text/css" href="/css/fixed-width.css" id="layout">
+    <link rel="stylesheet" type="text/css" href="/css/style.css">
+
+    <!-- Java Script  -->
+    <script src="/js/jquery.js"></script>
+    <script src="/js/custom.js"></script>
+    <script src="/js/selectnav.js"></script>
+    <script src="/js/flexslider.js"></script>
+    <script src="/js/twitter.js"></script>
+    <script src="/js/fancybox.js"></script>
+    <script src="/js/isotope.js"></script>
+    <script src="/js/bootstrap.js"></script>
+    <script src="/js/showcase.js"></script>
+
+    <!-- Google Analytics -->
+    <script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-37926454-1']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();
+
+    </script>
+
+
+</head>
+<body>
+
+<!-- Wrapper Start -->
+<div id="wrapper" class="container-fluid">
+
+
+    <!-- Header -->
+
+
+    <div class="ie-dropdown-fix" >
+
+        <!-- Header -->
+        <div class="row-fluid" id="header">
+
+            <!-- Logo -->
+            <div class="span5">
+
+                <a href="#"><img src="/images/logo_01_fullcolor-sm.png" alt="Apache Flex®" title="Apache Flex®" /></a>
+
+            </div>
+
+            <!-- Social / Contact -->
+            <div class="span3 pull-right">
+
+                <!-- Social Icons -->
+                <ul class="social-icons">
+                    <li class="facebook"><a href="https://www.facebook.com/pages/Apache-Flex/174249699342648">Facebook</a></li>
+                    <li class="twitter"><a href="http://twitter.com/ApacheFlex">Twitter</a></li>
+                    <li class="linkedin"><a href="http://www.linkedin.com/groups/Apache-Flex-Developers-4296888">LinkedIn</a></li>
+                </ul>
+
+                <!-- Apache Logo -->
+                <a href="http://www.apache.org" id="contact-top"><img src="http://www.apache.org/images/feather-small.gif" title="An Apache Project" alt="An Apache Project" /> </a>
+            </div>
+
+        </div>
+        <!-- Header / End -->
+
+        <!-- Navigation -->
+        <div id="navigation" class="margintop">
+            <ul id="nav">
+
+                <li><a href="index.html">Home</a></li>
+
+                <li><a href="#">About Flex</a>
+                    <ul>
+
+                        <li><a href="/about-whatis.html">What is Flex?</a></li>
+                        <li><a href="/about-features.html">Features</a></li>
+                        <li><a href="/about-licensing.html">License &amp; Trademarks</a></li>
+                        <li><a href="/about-people.html">The Team</a></li>
+                        <li><a href="/about-history.html">Project History</a></li>
+                        <li><a href="/about-assets.html">Logo and Assets</a></li>
+                    </ul>
+                </li>
+                <li><a href="#">Community</a>
+                    <ul>
+
+                        <li><a href="/community-getinvolved.html">How to get involved</a></li>
+                        <li><a href="/community-mailinglists.html">Mailing Lists</a></li>
+                        <li><a href="/community-showcase.html">Flex Showcase</a></li>
+						<li><a href="/community-3rdparty.html">Third-Party</a></li>
+                        <li><a href="https://cwiki.apache.org/confluence/display/FLEX/Apache+Flex+Wiki">Wiki <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://blogs.apache.org/flex/">Blog <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Development</a>
+                    <ul>
+                        <li><a href="/dev-faq.html">Developer FAQ</a></li>
+                        <li><a href="/dev-sourcecode.html">Source Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/FLEX">Bug-Tracker <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Documentation</a>
+                    <ul>
+
+                        <li><a href="/doc-getstarted.html">Getting Started</a></li>
+                        <li><a href="/doc-videos.html">Videos</a></li>
+                        <li><a href="/asdoc/">ASDocs</a></li>
+                        <li><a href="http://help.adobe.com/en_US/flex/using/index.html">Documentation Reference (Old) <i class="icon-share icon-white"></i></a></li>
+
+                    </ul>
+                </li>
+
+                <li><a href="#">About Apache</a>
+                    <ul>
+
+                        <li><a href="http://www.apache.org">The Apache Software Foundation Website <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/contributing.html">Donations <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#" class="download">Download</a>
+                    <ul>
+
+                        <li><a href="/installer.html">Download the SDK Installer (For Application Developers)</a></li>
+                        <li><a href="/download-binaries.html">Download the SDK Binaries (For SDK Developers)</a></li>
+                        <li><a href="/download-source.html">Download the SDK Source Code (For SDK Developers)</a></li>
+                        <li><a href="/download-utilities.html">Download Utilities</a></li>
+                        <li><a href="/download-archive.html">Previous Versions</a></li>
+                    </ul>
+                </li>
+            </ul>
+
+        </div>
+        <div class="nav-shadow"></div>
+        <div class="clear"></div>
+
+    </div>
+    <!-- Navigation / End -->
+
+
+    <!-- Content -->
+
+    
+    <div class="row-fluid">
+
+
+        <!-- Page Title -->
+        <div id="page-title">
+            <h2>Unit 10 - Mock Classes
</h2>
+        </div>
+        <!-- Page Title / End -->
+
+
+    </div>
+    
+
+    <div class="row-fluid">
+
+
+
+<!-- Home Page Exception -->
+
+
+<p><a href="../code/unit10.zip"><img src="../images/DownloadIcon.png" alt="Download" /> Download Unit Project Files</a></p>
+<p>In the beginning of this course you learned that unit testing a class requires that it be isolated from other dependencies. In this way, you can test your code free from unnecessary complexity and potentially unknown side effects introduced by other classes.</p>
+
+<p>Mocking is one technique for isolating your class. It works by providing intelligent substitutes for class dependencies.</p>
+
+<h3>Objectives:</h3>
+
+<p>After completing this lesson, you should be able to:</p>
+
+<ul>
+    <li>Create test cases using Mock Objects</li>
+    <li>Use the Mockolate Rule to automatically create mocks</li>
+    <li>Add and validate mock functionality with stubbing, spying, and verification</li>
+    <li>Set expectations for mock classes using the Mockolate framework</li>
+</ul>
+
+<h3>Topics</h3>
+
+<p>In this unit, you will learn about the following topics:</p>
+
+<ul>
+    <li>Understanding the use case for mocks</li>
+    <li>Examining available mocking frameworks</li>
+    <li>Using Rules</li>
+    <li>Working with a mock</li>
+    <li>Using the Mockolate Rule</li>
+    <li>Creating a test with mock objects</li>
+    <li>Individual verifications</li>
+</ul>
+
+<h2>Understanding the use case for mocks</h2>
+
+<p>When unit testing a system, it is essential that its components are tested in isolation.</p>
+
+<p>Consider this example:</p>
+
+<ol>
+    <li><p>A Schedule class facilitates the storage of appointments in a database.</p></li>
+    <li><p>The scheduleAppointment, cancelAppointment, and modifyAppointment methods of the Schedule class need to be tested.</p></li>
+    <li><p>As you might imagine, each of these methods takes several parameters and each has several different outcomes requiring many tests.</p></li>
+    <li><p>In production, the Schedule class interacts with services that make connections to a remote database to retrieve and store schedule information.</p></li> 
+</ol>
+
+<p>Consider the possible dependencies involved in the Schedule class in the system. First, the class interacts with services in some way, making the services a dependency. The services connect to a database, likely through an application server. The request is sent over the network, meaning that the network card, protocol stack and physical connections are all involved.</p>
+
+<p>There are a huge number of problems with testing this system. If a failure occurs in any of the layers mentioned above, the tests for your Schedule Class will fail. Given that situation, how can you possibly determine the cause of the failure?</p>
+
+<p>Additionally, tests written against an entire system like this can take significant time to retrieve data or produce a failure. This extra time discourages you from running the test frequently.</p>
+
+<p>If you attempt to test the entire system, then you are not testing the Schedule class in isolation and it is therefore not a unit test.</p>
+
+<p>You could try to solve this issue in a number of ways. You could create test versions of the database, but this adds extra effort and maintenance to objects that have nothing to do with the class functionality. You could create your application to return fake or stub data in specific circumstances, but this again causes extra maintenance and means that you are testing your system in a slightly different way than it is deployed.</p>
+
+<p>Test substitutes can be used to solve these problems. Test substitutes are essentially fake versions of objects used for testing. In this case, if code is well architected, you can provide a test substitute for the services used by the Schedule class. These substitutes generally come in two flavors: Fake objects and Mock objects.</p>
+
+<p><p>Fake objects are object shells that have very little functionality of their own. They may have no functionality, or only functionality that can be verified by simple visual inspection. This lack of functionality means that the Fake object is not suspect when a test failure occurs, thus refocusing the tests back to the Schedule class itself.</p>
+<p>The second type of substitute object used is a Mock object. Mocks are similar to Fake objects; however, they are more intelligent and complex internally. Mock objects allow you to set expectations and verify those expectations.</p>
+<p>In other words, you could provide a service layer Mock to the Schedule class and indicate that the Mock should expect to see its <code>callTheServer()</code> method called and passed a particular schedule entry.</p>
+<p>Mocks are extremely useful and can once again increase the legibility of your test cases. As Mocks are not verifiable via simple visual inspection, they are often built upon a mocking framework that provides the base mock functionality and a suite of tests to prove it works correctly. This again lets you focus on the Schedule class instead of testing all of its external dependencies.</p></p>
+<h2>Examining available Mocking frameworks</h2>
+
+<p>There are many mocking frameworks available to the ActionScript community. This list should not be considered an exhaustive list, but these are among the more popular at the time of writing.</p>
+
+<ul>
+    <li>asmock</li>
+    <ul>
+        <li>Provides a specialized runner for FlexUnit 4</li>
+        <li>Creates mock versions of a class's public interface</li>
+        <li>Allows creation of required and optional results</li>
+    </ul>
+    <li>mock-as3</li>
+    <ul>
+        <li>Older mocking framework that required the creation of static classes that act as mocks.</li>
+        <li>The author of mock-as3 has released a newer framework named Mockolate which will be used in this unit.</li>
+    </ul>
+    <li>mock4as</li>
+    <ul>
+        <li>Minimalistic framework</li>
+        <li>Can use subclassing or composition</li>
+        <li>With effort, can return very detailed customized results</li>
+        <li>mockito-flexTest spy framework that works with FlexUnit 4.x</li>
+        <li>Extension of asmock</li>
+    </ul>
+    <li>mockolate</li>
+    <ul>
+        <li>Uses a custom FlexUnit Rule to institute mock behavior</li>
+        <li>Can be run alongside other custom runners</li>
+        <li>Allows creation of strict or nice mocks</li>
+        <ul>
+            <li>Nice mocks do not require expectations on all behavior allowing testing of only specific functionality.</li>
+            <li>Strict mocks require expectations on all behavior.</li>
+        </ul>
+    </ul>
+</ul>
+
+<p>In this course you will use Mockolate. The developers of Mockolate are active contributors to the FlexUnit project.</p>
+
+<h2>Working with a mock</h2>
+
+<p>Mocks set up a special form of a substitute object which records all method calls and property access of the mock. Each time a method on the mock is called, the arguments supplied are recorded.</p>
+
+<p><p>Mocks can also be configured to return known values based on given input. In other words, a mock could be told to return true each time a given method is called providing the minimal necessary logic to test your class.</p>
+<p>Setting up a mock requires understanding the expected interaction between the object under test and the mocked dependency as you are simulating the behavior of the real object.</p> 
+<p>Unfortunately, the close knit behavior of the mock object and the real object it is mocking does create some additional maintenance on the test system. Failure to maintain the mock conditions can create false positives or false negatives.</p> 
+<p>To use a mock, you must first create an instance of the mock object. Once the object is created, you must inject the mock in place of the real object. Effectively, mocks make use of the object oriented concept of polymorphism to ensure that the system under test will not notice any difference between the real and mock object. The mock object will then begin recording any access including method calls, arguments and property access.</p>
+<p>The syntax for creating and using a mock depends on the mocking framework used. For this course you will use Mockolate. Mockolate may be used in two ways: either by setting expectations and verifying the expectations were met or by using test spies to replay the calls on a mocked object and verify its expected behavior.</p>
+<p>Mock objects can:</p>
+<ul>
+    <li>Return a value or sequence of values</li>
+    <li>Dispatch events</li>
+    <li>Call other functions</li>
+    <li>Throw Errors</li>
+</ul></p>
+<h2>Using Rules</h2>
+
+<p>Rules are objects that implement a specific interface to allow developer extension of the main test runner provided with FlexUnit 4. Using rules, a developer may create reusable test fixtures, evaluate a test differently or add steps into the test evaluation process. You will examine rules in more detail later; however, they are being briefly introduced at this time as the primary way of using Mockolate is through a Rule.</p>
+
+<p>To use a rule, instantiate a public property in a test case, and decorate the property with the [Rule] metadata:</p>
+
+<p><code><pre>[Rule]
+public var myRuleThatDoesSomethingCool:MyRule = new MyRule();</pre></code></p>
+<h2>Using the MockolateRule</h2>
+
+<p>Included in the Mockolate library is a rule named MockolateRule. It is specifically for use with FlexUnit 4. The Mockolate rule saves many manual steps required to create mocks.</p>
+
+<p>Different mocking frameworks work in different ways. Mockolate works by creating compiled ActionScript code for the required mock object in memory at runtime. This is an extremely effective and useful technique; however, Flash Player does not allow this operation to occur synchronously. Therefore, setting up a Mockolate mock is an asynchronous process. The Mockolate rule manages these details without your intervention.</p>
+
+<p>To use the rule, include the following:</p>
+
+<p><code><pre>[Rule]
+public var mockRule:MockolateRule = new MockolateRule();</pre></code></p>
+<p>Once the rule is included, you may use a special piece of metadata named [Mock] to create and inject Mockolate mocks.  You will do this in the following walkthrough.</p>
+
+<h2>Walkthrough 1: Adding a Simple Mockolate Rule</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Change the Circle class to handle default mock creation.</li>
+    <li>Create a new test case to handle mocks.</li>
+    <li>Establish a MockolateRule to instantiate mock objects for testing.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Import the FlexUnit4Training_wt1.fxp project from the Unit 10/Start folder. If you completed the previous walkthrough, choose the option to overwrite your existing project. If this is your first walkthrough, import it as a new project.  Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+        <p>The new FlexUnit4Training project contains everything that all the walkthroughs up until this point have accomplished. Additionally, it includes several new files and additional dependencies to help you through the current walkthrough.</p>
+
+        <h3><br />Changing the Circle class</h3>
+
+    </li>
+    <li>
+        <p>Open the Circle.as file in the src directory in the package net.digitalprimates.math.</p>
+    </li>
+    <li>
+        <p>Take a look at the constructor for the class:</p>
+        <code><pre>public function Circle( origin:Point, radius:Number )</pre></code>
+        <p>Currently, the constructor takes two arguments, a <code>Point</code> and a <code>Number</code>. In this walkthrough, you will be mocking this object. Mock automatically passes default parameters for all arguments. This means origin will be <code>null</code> and the radius will be <code>0</code>. A circle cannot have a <code>null</code> origin or a radius of <code>0</code>, you will need to handle these cases. Later, you will be shown how to pass actual values to the mock.</p>
+    </li>
+    <li>
+        <p>Comment out the range check for radius.</p>
+
+        <code><pre>
+// if( ( radius &#60;= 0 || isNaN( radius ) ) {
+//  throw new RangeError( "Radius must be a positive Number" );
+// }</pre></code>
+
+        <p>You are commenting this out for simplicity. The default radius of 0 will cause the range error to be thrown. This will prevent that from happening.</p>
+    </li>
+    <li>
+        <p>Immediately after the range check for radius, add a null check for origin. If origin is null, instantiate to a new <code>Point</code> with x and y of 0.</p>
+
+        <code><pre>if( origin == null ) {
+    origin = new Point( 0, 0 );
+}</pre></code>
+
+        <p>Your <code>Circle</code> constructor should now appear as follows:</p>
+
+        <code><pre>public function Circle( origin:Point, radius:Number ) {
+    // if( ( radius &#60;= 0 || isNaN( radius ) ) {
+    //  throw new RangeError( "Radius must be a positive Number" );
+    // }
+
+    if( origin == null ) {
+        origin = new Point( 0, 0 );
+    }
+
+    this._origin = origin;
+    this._radius = radius;
+}</pre></code>
+
+        <h3><br />Declare the MockolateRule</h3>
+    </li>
+    <li>
+        <p>Create a new ActionScript class named CircleMockTest in the math.testcases package within the tests directory.</p>
+    </li>
+    <li>
+        <p>Remove the automatically created constructor from the test class.</p>
+    </li>
+    <li>
+        <p>Add and instantiate a public variable named <code>mockRule</code> of type <code>MockolateRule</code> to the CircleMockTest class. Mark the variable with <code>[Rule]</code> metadata.</p>
+
+        <code><pre>[Rule]
+public var mockRule:MockolateRule = new MockolateRule();</pre></code>
+
+        <p>If you did not use code-completion, add the import for mockolate.runner.MockolateRule at this time.</p>
+    </li>
+    <li>
+        <p>Add a variable named <code>mockCircle</code> of type <code>Circle</code> to the class. Mark the variable with <code>[Mock]</code> metadata.</p>
+
+        <code><pre>
+[Mock]
+public var mockCircle:Circle;</pre></code>
+
+        <p><code>[Mock]</code> metadata marks a variable for mock creation and injection. Mock creation is the equivalent of object instantiation within the Mockolate framework. Variables marked with this metadata are prepared for use as Mocks. By using the MockolateRule, this mock will be instantiated with default values prior to any tests being run in the test case.</p>
+        <p>If you did not use code-completion, add the import for net.digitalprimates.math.Circle at this time.</p>
+    </li>
+    <li>
+        <p>Add a method named <code>shouldBeNotNull()</code>. It will assert that the <code>mockCircle</code> is not null.</p>
+
+        <code><pre>[Test]
+public function shouldBeNotNull():void {
+    assertThat(mockCircle, notNullValue() );
+}</pre></code>
+
+        <p>If you did not use code-completion, add the import statements for org.flexunit.assertThat and org.hamcrest.object.notNullValue at this time.</p>
+    </li>
+    <li>
+        <p>Save CircleMockTest.as.</p>
+
+        <h3><br />Add the CircleMockTest to the CircleSuite</h3>
+
+    </li>
+    <li>
+        <p>Open the CircleSuite.as file within the math.testcases package. Add a new public variable named <code>test4</code> with a type of <code>CircleMockTest</code></p>
+
+        <code><pre>[Suite]
+[RunWith("org.flexunit.runners.Suite")]
+public class CircleSuite {
+    public var test1:BasicCircleTest;
+    public var test2:CircleConstructorTest;
+    public var test3:CircleTheory;
+    public var test4:CircleMockTest;
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Save the CircleSuite.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image1.png' /> 
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+
+        <p>Notice the failure. This is because you commented out the range check in Circle. The CircleConstructorTest is expecting this error to be thrown. This is an unfortunate side effect of changing the Circle class. This will be corrected when you inject the mock later.</p>
+    </li>
+</ol>
+
+<h2>Creating a test with mock objects</h2>
+
+<p>Mockolate has logic for two types of mocks: nice and strict.</p>
+
+<ul>
+    <li>Nice Mocks only require methods and properties with expectations to be stubbed or mocked. Other methods or properties in the mock object will return fake or generic values that will not throw errors, necessarily.</li> 
+    <li>Strict Mocks throw an InvocationError for any method called that is not mocked or stubbed. In other words, the complete functionality of the mock has to be mocked or stubbed in order to test with the mock.</li>
+</ul>
+
+<p>By default, Mockolate creates nice, injected mocks.</p>
+
+<p>To create a mock, create the variable as normal and decorate it with the [Mock] metadata.</p>
+
+<p><code><pre>[Mock]
+public var myMock:MockableObject;</pre></code></p>
+<p>The [Mock] metadata accepts two possible arguments: <code>type</code> and <code>inject</code></p>
+
+<ul>
+    <li>type - <code>strict</code> or <code>nice</code></li>
+    <li>inject - <code>true</code> or <code>false</code> - If set to false, will prepare (create the ActionScript byte code) the mock but not create it. The mock will need to be instantiated before it is used.  Non-injected mocks are generally only used when the mocked object's constructor has parameters.</li>
+</ul>
+
+<p>By default, Mockolate creates a nice, injected mock.</p>
+
+<p>A strict, non-injected mock would appear as:</p>
+
+<p><code><pre>[Mock(type="strict",inject="false")]
+public var myMock:MockableObject;</pre></code></p>
+<p>Once the mock is created, it can be used in tests.  To use the mock you must <i>stub</i> or <i>mock</i> all methods or properties under test.</p>
+
+<ul>
+    <li>stub - specifies optional behaviors or expectations</li>
+    <li>mock - specifies required behaviors or expectations</li>
+</ul>
+
+<p>Stubbing or mocking is used to define the behavior of the object.  Without stubbing or mocking a method or property will return values of null, false, or some other probably useless value.</p>
+
+<p><p>A method or property can be stubbed to:</p>
+<ul>
+    <li>Return a getter</li>
+    <code><pre>stub(myMock).getter("name").returns("Useful Mock");</pre></code>
+</ul>
+<ul>
+    <li>A method without arguments</li>
+    <code><pre>stub(myMock).method("toString").returns("Useful Mock");</pre></code>
+</ul>
+<ul>
+    <li>With args</li>
+    <code><pre>stub(myMock).method("add").args(3, 5).returns(8);</pre></code>
+</ul>
+<ul>
+    <li>With Hamcrest</li>
+    <code><pre>stub(myMock).method("repeatIt").args(instanceOf(String)).returns(instanceOf(String));</pre></code>
+</ul>
+<p>This list is not exhaustive.  If the real object can do it, the mock can likely simulate the behavior.  All of these approaches can be used with mocks as well to set required behaviors.</p>
+<p>Mocks are used to stand-in as complex objects for a given class or methods under test. Furthermore, they are used to isolate the system under test, so extraneous dependencies are not interfering with test execution or expectations.</p></p>
+<h2>Walkthrough 2: Setting Expectations</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Create a nice mock expectation.</li>
+    <li>Create a strict mock expectation.</li>
+</ul>
+
+<h3>Setting nice mock expectations</h3>
+
+<ol>
+    <li>
+        <p>Open the CircleMockTest.as file from the previous walkthrough.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt2.fxp project from the Unit 10/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+    </li>
+    <li>
+        <p>Add a new method <code>shouldBeEqualCircleMock()</code> decorated with the test metadata.</p>
+
+        <code><pre>[Test]
+public function shouldBeEqualCircleMock():void {
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Set an expectation that the <code>origin</code> getter will be called at least once. To set an expectation, you use the <code>mock()</code> method of the <code>MockolateRule</code>. You will also need to use the <code>getter()</code> method.</p>
+
+        <code><pre>mock( mockCircle ).getter( "origin" ).atLeast( 1 );</pre></code>
+
+        <p>If you did not use code-completion, import mockolate.mock at this time.</p>
+    </li>
+    <li>
+        <p>Save the CircleMockTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image2.png' /> 
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+
+        <p>You will notice an error. This is because the mock expects the origin getter would be called at least once. However, no call was ever made to the getter. You will need to add this call.</p>
+        <p>If you had made this call as a stub rather than a mock, this expectation would have been optional and thus fulfilled.</p>
+
+        <h3><br />Fulfilling the expectation</h3>
+
+        <p>You need to fulfill the expectation. You could make the call directly to origin, but this would defeat the purpose of creating the mock. Mocks require some internal workings of how an object operates. Inside the Circle class is a method called <code>equals()</code>. Equals checks if two circles have the same origin and radius.</p>
+    </li>
+    <li>
+        <p>In <code>shouldBeEqualCircleMock()</code>, but after the mock expectation, create a new <code>Circle</code> called <code>circle</code>. As arguments, pass a new origin at <code>Point( 0, 0 )</code> and a radius of <code>0</code>.</p>
+
+        <code><pre>var circle:Circle = new Circle( new Point( 0, 0 ), 0 );</pre></code>
+
+        <p>You are passing this circle because the default mock created an origin at 0, 0 with a radius of 0.</p>
+        <p>If you did not use code-completion, add the import for flash.geom.Point.</p>
+    </li>
+    <li>
+        <p>In <code>shouldBeEqualCircleMock()</code>, after the circle is instantiated, make a call to the <code>equals()</code> method of circle. Pass it the <code>mockCircle</code> as a parameter.</p>
+
+        <code><pre>circle.equals( mockCircle );</pre></code>
+
+    </li>
+    <li>
+        <p>Save the CircleMockTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image4.png' />
+        <p class='caption' id='shift'>Figure 2: FlexUnit tests passed</p>
+
+        <p>The expectation has now been fulfilled and the test is now passing. Next you will attempt to use a strict mock.</p>
+
+        <h3><br />Using a strict mock</h3>
+
+    </li>
+    <li>
+        <p>Add the <code>type="strict"</code> annotation to the Mock metadata of <code>mockCircle</code>.</p>
+        <code><pre>[Mock( type="strict" )]</pre></code>     
+    </li>
+    <li>
+        <p>Save the CircleMockTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image2.png' /> 
+        <p class='caption' id='shift'>Figure 3: FlexUnit tests passed</p>
+
+        <p>You will notice another error. Changing the mock to a strict mock requires you to set expectations on all methods and properties that are called as part of the method call.</p>
+        <p>If you look at the stack trace you will be able to see the error.</p>
+
+        <img alt='StackTrace' id='shift' src='../images/unit10/image5.png' />
+        <p class='caption' id='shift'>Figure 4: Stack Trace</p>
+
+        <p>This error was thrown because no expectation was set for a getter named <code>radius</code>. You will need to add this expectation.</p>
+    </li>
+    <li>
+        <p>At the top of the <code>shouldBeEqualCircleMock()</code>, add the expectation for <code>radius</code> to be called at least once.</p>
+        <code><pre>mock( mockCircle ).getter( "radius" ).atLeast( 1 );</pre></code>     
+    </li>
+    <li>
+        <p>Save the CircleMockTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image4.png' /> 
+        <p class='caption' id='shift'>Figure 5: FlexUnit tests passed</p>
+    </li>
+</ol>
+
+<h2>Individual Verifications</h2>
+
+<p>You may have noticed a problem with verifying a strict mock's behavior. In a strict mock, all properties and methods need to have an expectation set. If a method is called or a property accessed without an expectation the mock will throw an error. Frequently, this will force you to set expectations outside of the scope of the test, and, while this will produce a correct result it may create unnecessary overhead in test production. This also ties the test to a specific implementation of the mocked object; if the object implementation changes but the result of the test remains the same this test will need to be refactored.</p>
+
+<p>In this case, you may use a nice mock. A nice mock is friendly and places none of the requirements on mocking or stubbing every called method. In fact, it will accept any calls placed on it and simply record the behavior. Nice mocks can be tested by setting expectations and verifying results.</p>
+
+<h2>Injecting a Mock Manually</h2>
+
+<p>When injected automatically, mocks pass default parameters to any constructor args, 0 for Number, the empty string for Strings, and null for most other objects. In order to set these constructor arguments to anything else you need to inject the mock manually. Mockolate has a special [Mock] annotation called <code>inject</code> that may be applied to modify mock creation. <code>Inject</code> has two values: <code>true</code> or <code>false</code>. A non-injected mock would appear as:</p>
+
+<p><code><pre>[Mock( inject="false" )]
+public var mockPoint:Point;</pre></code></p>
+<p>There are two methods to inject a mock, depending on the type, <code>nice()</code> or <code>strict()</code>. The method used must match the mock or an error will be thrown. Both of these take three parameters: the mock, an optional name and optional arguments. Arguments must be specified as an ordered array.</p>
+
+<p>For Point:</p>
+
+<p><code><pre>mockPoint = nice( Point, "myPoint", [ 0, 0 ] );</pre></code></p>
+<h2>Walkthrough 3: Injecting mocks</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Inject a mock with parameters.</li>
+    <li>Set a getter to return a value.</li>
+    <li>Revert the changes made to the <code>Circle</code> class in Walkthrough 1.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the CircleMockTest.as file from the previous walkthrough.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt3.fxp project from the Unit 10/ Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Injecting a mock manually</h3>
+
+    </li>
+    <li>
+        <p>Modify the current mock <code>Circle</code> to create the mock but not inject. To do so, add the inject annotation to the Mock metadata decorating the <code>mockCircle</code> variable.</p>
+        <p>Replace:</p>
+
+        <code><pre>[Mock( type="strict" )]
+Public var mockCircle:Circle;</pre></code>
+
+        <p>With</p>
+
+        <code><pre>[Mock( inject="false", type="strict" )
+Public var mockCircle:Circle;</pre></code>
+
+    </li>
+    <li>
+        <p>Create a new method named <code>setup()</code> decorated with the Before metadata.</p>
+
+        <code><pre>[Before]
+public function setup():void {
+}</pre></code>
+
+    </li>
+    <li>
+        <p>In the before method, inject a strict mock using the <code>strict()</code> method. Pass this method the <code>Circle</code> class, "<code>mockCircle</code>", and the array <code>[ new Point( 0, 0 ), 1  ]</code>. Assign the return for <code>strict()</code> to the <code>mockCircle</code> instance.</p>
+
+        <code><pre>[Before]
+public function setup():void {
+mockCircle = strict( Circle, "mockCircle", [ new Point( 0, 0 ), 1 ] );
+}</pre></code>
+
+        <p>Since the constructor arguments are now being passed, the range test in the <code>Circle</code> constructor is now satisfied. However, the getters will still return default values. Mocks do not use any of the instance properties. You will need to mock the getters for <code>radius</code> and <code>origin</code> to return values.</p>
+        <p>If you did not use code-completion, add the import for mockolate.strict.</p>
+    </li>
+    <li>
+        <p>Replace the lines:</p>
+
+        <code><pre>mock( mockCircle ).getter( "origin" ).atLeast( 1 );
+mock( mockCircle ).getter( "radius" ).atLeast( 1 );</pre></code>
+
+        <p>with</p>
+
+        <code><pre>mock( mockCircle ).getter( "origin" ).returns( new Point( 0, 0 ) ).atLeast( 1 );
+mock( mockCircle ).getter( "radius" ).returns( 1 ).atLeast( 1 );</pre></code>
+
+        <p>This will force the getter and setter to return the required values.</p>
+        <p>If you were to run the test now, it would pass with no errors. However, this does not fulfill the test "shouldBeEqualCircleMock"</p>
+    </li>
+    <li>
+        <p>Change the radius of the circle you instantiate, from a value of 0, to a value of 1.</p>
+
+        <code><pre>var circle:Circle = new Circle( new Point( 0, 0 ), 1 );</pre></code>
+
+        <p>We want to compare that this circle is equal to our mock circle, so they should both have the same radius.</p>
+    </li>
+    <li>
+        <p>Replace the line:</p>
+
+        <code><pre>circle.equals( mockCircle );</pre></code>
+
+        <p>With</p>
+
+        <code><pre>assertTrue( circle.equals( mockCircle ) );</pre></code>
+
+        <p>If you did not use code-completion, add the import for org.flexUnit.asserts.assertTrue</p>
+
+        <h3><br />Revert the changes to the Circle class.</h3>
+
+    </li>
+    <li>
+        <p>Open the net.digitalprimates.math.Circle.as file in the src directory.</p>
+        <p>In Walkthrough 1, you modified the <code>Circle</code> class to accept invalid parameters so that you could use mocks. You will now need to revert these changes.</p>
+    </li>
+    <li>
+        <p>Uncomment the following section:</p>
+
+        <code><pre>
+// if ( ( radius &#60;= 0 ) || isNaN( radius ) ) {
+//  throw new RangeError("Radius must be a positive Number");
+// }</pre></code>
+
+    </li>
+    <li>
+        <p>Remove the origin null check. This section is no longer required.</p>
+        <p>Remove:</p>
+
+        <code><pre>if( origin == null ) {
+    origin = new Point( 0, 0 );
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Save the Circle.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image6.png' />
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+
+        <p>The mock is now acting as a stand in of a Circle, accepting parameters and returning the values you have requested. In this way, any object can be mocked to operate exactly as expected, or to test that the expected behaviors are called on the object. In the next walkthrough, you will learn how to mock methods to accept parameters and return values.</p>   
+    </li>
+</ol>
+
+<h2>Walkthrough 4: Method Mocking</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Mock the <code>Point</code> class.</li>
+    <li>Mock the <code>add()</code> method of the <code>Point</code> class.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Create a new ActionScript class named DistanceTest in the math.testcases package within the tests directory.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt4.fxp project from the Unit 10/ Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Create the test fixture</h3>
+
+    </li>
+    <li>
+        <p>Remove the automatically created constructor from the test class.</p>
+    </li>
+    <li>
+        <p>Create a private static constant named <code>TOLERANCE</code> as a <code>Number</code>, with a value of <code>.01</code>.</p>
+        <code><pre>private static const TOLERANCE:Number = .01;</pre></code>
+    </li>
+    <li>
+        <p>Add and instantiate a public variable named <code>mockRule</code> of type <code>MockolateRule</code> to the <code>LayoutTest</code> class. Mark the variable with <code>[Rule]</code> metadata.</p>
+
+        <code><pre>[Rule]
+public var mockRule:MockolateRule = new MockolateRule();</pre></code>
+
+        <p>If you did not use code-completion, add the import for mockolate.runner.MockolateRule at this time.</p>
+    </li>
+    <li>
+        <p>Add a variable named <code>mockPoint</code> of type <code>Point</code> to the class. Mark the variable with <code>[Mock]</code> metadata.</p>
+
+        <code><pre>[Mock]
+public var mockPoint:Point;</pre></code>
+
+        <p>If you did not use code completion, add the import for flash.geom.Point at this time.</p>
+
+        <h3><br />Mocking a method</h3>
+
+    </li>
+    <li>
+        <p>Create a new test method named <code>shouldBeEqualDistance()</code>. Decorate it with <code>[Test]</code> metadata.</p>
+
+        <code><pre>[Test]
+public function shouldBeEqualDistance():void {
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Create a new <code>Point</code> called <code>testPoint</code> with x and y values of 5 and 5, respectively.</p>
+
+        <code><pre>var testPoint:Point = new Point( 5, 5 );</pre></code>
+
+    </li>
+    <li>
+        <p>Create a new <code>Point</code> called <code>endPoint</code> with x and y values of 10 and 10, respectively.</p>
+
+        <code><pre>var endPoint:Point = new Point( 10, 10 );</pre></code>
+
+    </li>
+    <li>
+        <p>Create one last <code>Point</code> called <code>summedPoints</code>. Do not instantiate it at this time.</p>
+
+        <code><pre>var summedPoints:Point;</pre></code>
+
+    </li>
+    <li>
+        <p>Add an expectation for the <code>add()</code> method of <code>mockPoint</code> to take an argument, <code>testPoint</code>, and return a new <code>Point</code> with x and y values of 10 and 10.</p>
+
+        <code><pre>mock( mockPoint ).method( "add" ).args( testPoint ).returns( new Point( 10, 10 ) );</pre></code>
+
+        <p>The mock will now expect the <code>add()</code> method of <code>mockPoint</code> to be called with the <code>testPoint</code> parameter. When it does, it will return a <code>Point</code> with x and y values of 10 and 10.</p>
+    </li>
+    <li>
+        <p>Make a call to <code>mockPoint.add()</code> passing it the parameter <code>testPoint</code> and assigning the return to <code>summedPoints</code>.</p>
+
+        <code><pre>summedPoints = mockPoint.add( testPoint );</pre></code>
+
+    </li>
+    <li>
+        <p>Add a call to <code>assertThat()</code> passing it the parameters <code>endPoint</code> and a new <code>CloseToPointMather</code> with parameters <code>summedPoints</code> and <code>TOLERANCE</code>.</p>
+
+        <code><pre>assertThat( endPoint, new CloseToPointMatcher( summedPoints, TOLERANCE ) );</pre></code>
+
+        <p>If you did not use code completion, add the imports for org.flexunit.assertThat and matcher.CloseToPointMatcher at this time.</p>
+    </li>
+    <li>
+        <p>Save the DistanceTest.as file.</p>
+
+        <h3><br />Add DistanceTest to the test suite</h3>
+
+    </li>
+    <li>
+        <p>Open the CircleSuite.as file within the math.testcases package. Add a new public variable named <code>test5</code> with a type of <code>DistanceTest</code></p>
+
+        <code><pre>[Suite]
+[RunWith("org.flexunit.runners.Suite")]
+public class CircleSuite {
+    public var test1:BasicCircleTest;
+    public var test2:CircleConstructorTest;
+    public var test3:CircleTheory;
+    public var test4:CircleMockTest;
+    public var test5:DistanceTest;
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Save the CircleSuite.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit10/image7.png' />
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+    </li>
+</ol>
+
+<h2>Summary</h2>
+
+<ul>
+    <li><p>Mocks are created and plugged in to test cases to further isolate test cases and classes validating their functionality with minimal external dependency.</p></li>
+    <li><p>The mocking framework that this course uses is Mockolate. Mockolate features:</p></li>
+    <ul>
+        <li><p>Nice mocks</p></li>
+        <li><p>Strict mocks</p></li>
+        <li><p>Mocks instantiated with a custom FlexUnit rule</p></li>
+        <li><p>Can be run alongside other FlexUnit custom runners</p></li>
+    </ul>
+    <li><p>When a MockolateRule is used, mocks are instantiated as <code>nice</code> by default.</p></li>
+    <li><p>Setting expectations for <code>strict</code> mocks requires an expectation for every method that will be run.</p></li>
+    <li><p>Expectations can be verified individually on nice mocks, which allows for greater specificity.</p></li>
+</ul>
+
+<h2>Navigation</h2>
+
+<ul>
+    <li><a href="Unit-9.html">Unit 9 - External Data</a></li>
+    <li><a href="Unit-11.html">Unit 11 - Parameterized Tests</a></li>
+    <li><a href="../index.html">Table of Contents / Introduction</a></li>
+</ul>
+
+<!-- Home Page Exception -->
+
+
+
+
+</div></div>
+<!-- Wrapper / End -->
+
+
+<!-- Footer -->
+
+<!-- Footer Top -->
+<div id="footer" class="container-fluid paddingbottom" >
+
+
+    <div class="row-fluid">
+
+        <!-- About -->
+        <div class="span3">
+            <div class="footer-headline"><h4>About Us</h4></div>
+            <p>Apache Flex® is a highly productive, open source application framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops and devices (including smartphones, tablets and tv). It provides a modern, standards-based language and programming model that supports common design patterns suitable for developers from many backgrounds. Flex applications can be deployed to the ubiquitous Adobe® Flash® Player in the browser, Adobe® AIR™ on desktop and mobile or to native Android™, IOS™, QNX®, Windows® or Mac® applications.</p>
+        </div>
+
+        <!-- Subscribe  -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Subscribe</h4></div>
+            <p>We have two mailing lists, one for SDK developers, and one for SDK users.</p>
+            <p>Developers, send an email to <br>
+                <a href="mailto:dev-subscribe@flex.apache.org">dev-subscribe@flex.apache.org</a>
+            </p>
+            <p>Users, send an email to <br>
+                <a href="mailto:users-subscribe@flex.apache.org">users-subscribe@flex.apache.org</a>
+            </p>
+        </div>
+
+        <!-- Latest Releases -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Releases</h4></div>
+            <p>Apache Flex SDK : <a href="/download-binaries.html">4.12.0 (Mar 2014)</a><br />
+                SDK Installer : <a href="/installer.html">2.7.0 (Oct 2013)</a><br />
+                BlazeDS : <a href="http://sourceforge.net/adobe/blazeds/wiki/Home/">4.6.0 (Nov 2011)</a><br />
+                Flex Mavenizer : <a href="http://svn.apache.org/viewvc/flex/utilities/trunk/mavenizer/"> 4.8.0 (Jan 2013)</a></p>
+        </div>
+
+        <!-- Latest Tweets -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Tweets</h4></div>
+            <a class="twitter-timeline" href="https://twitter.com/ApacheFlex" data-chrome="noheader nofooter noborders noscrollbar" data-widget-id="364567612920852480">Tweets by Apache Flex</a>
+            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            <div class="clear"></div>
+        </div>
+
+    </div>
+
+</div>
+<!-- Footer / Bottom -->
+<div id="footer" class="container-fluid" style="background: #111;">
+    <div class="row-fluid">
+        <div class="span12">
+            <div id="footer-bottom">
+                Copyright © 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 <br>
+                Apache Flex, Apache and the Apache feather logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+                Read more about our privacy policy on our <a href="about-privacy.html">Privacy Policy</a> page.
+                <div id="scroll-top-top"><a href="#" title="Go to Top"></a></div>
+            </div>
+        </div>
+    </div>
+
+</div>
+
+<!-- Footer / End -->
+
+</body>
+
+</html>
\ No newline at end of file

Added: websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-11.html
==============================================================================
--- websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-11.html (added)
+++ websites/staging/flex/trunk/content/flexunit/tutorial/flexunit/Unit-11.html Fri Apr  4 01:17:29 2014
@@ -0,0 +1,741 @@
+<!DOCTYPE html>
+<!--[if IE 7 ]><html class="ie ie7" lang="en"><![endif]-->
+<!--[if IE 8 ]><html class="ie ie8" lang="en"><![endif]-->
+<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
+
+<head>
+
+    <meta charset="utf-8">
+    <title>Apache Flex® - Unit 11 - Parameterized Tests
</title>
+
+    <!-- For Mobiles  -->
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <link href='https://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
+    <!-- CSS -->
+    <link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
+    <link rel="stylesheet" type="text/css" href="/css/fixed-width.css" id="layout">
+    <link rel="stylesheet" type="text/css" href="/css/style.css">
+
+    <!-- Java Script  -->
+    <script src="/js/jquery.js"></script>
+    <script src="/js/custom.js"></script>
+    <script src="/js/selectnav.js"></script>
+    <script src="/js/flexslider.js"></script>
+    <script src="/js/twitter.js"></script>
+    <script src="/js/fancybox.js"></script>
+    <script src="/js/isotope.js"></script>
+    <script src="/js/bootstrap.js"></script>
+    <script src="/js/showcase.js"></script>
+
+    <!-- Google Analytics -->
+    <script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-37926454-1']);
+        _gaq.push(['_trackPageview']);
+
+        (function() {
+            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+        })();
+
+    </script>
+
+
+</head>
+<body>
+
+<!-- Wrapper Start -->
+<div id="wrapper" class="container-fluid">
+
+
+    <!-- Header -->
+
+
+    <div class="ie-dropdown-fix" >
+
+        <!-- Header -->
+        <div class="row-fluid" id="header">
+
+            <!-- Logo -->
+            <div class="span5">
+
+                <a href="#"><img src="/images/logo_01_fullcolor-sm.png" alt="Apache Flex®" title="Apache Flex®" /></a>
+
+            </div>
+
+            <!-- Social / Contact -->
+            <div class="span3 pull-right">
+
+                <!-- Social Icons -->
+                <ul class="social-icons">
+                    <li class="facebook"><a href="https://www.facebook.com/pages/Apache-Flex/174249699342648">Facebook</a></li>
+                    <li class="twitter"><a href="http://twitter.com/ApacheFlex">Twitter</a></li>
+                    <li class="linkedin"><a href="http://www.linkedin.com/groups/Apache-Flex-Developers-4296888">LinkedIn</a></li>
+                </ul>
+
+                <!-- Apache Logo -->
+                <a href="http://www.apache.org" id="contact-top"><img src="http://www.apache.org/images/feather-small.gif" title="An Apache Project" alt="An Apache Project" /> </a>
+            </div>
+
+        </div>
+        <!-- Header / End -->
+
+        <!-- Navigation -->
+        <div id="navigation" class="margintop">
+            <ul id="nav">
+
+                <li><a href="index.html">Home</a></li>
+
+                <li><a href="#">About Flex</a>
+                    <ul>
+
+                        <li><a href="/about-whatis.html">What is Flex?</a></li>
+                        <li><a href="/about-features.html">Features</a></li>
+                        <li><a href="/about-licensing.html">License &amp; Trademarks</a></li>
+                        <li><a href="/about-people.html">The Team</a></li>
+                        <li><a href="/about-history.html">Project History</a></li>
+                        <li><a href="/about-assets.html">Logo and Assets</a></li>
+                    </ul>
+                </li>
+                <li><a href="#">Community</a>
+                    <ul>
+
+                        <li><a href="/community-getinvolved.html">How to get involved</a></li>
+                        <li><a href="/community-mailinglists.html">Mailing Lists</a></li>
+                        <li><a href="/community-showcase.html">Flex Showcase</a></li>
+						<li><a href="/community-3rdparty.html">Third-Party</a></li>
+                        <li><a href="https://cwiki.apache.org/confluence/display/FLEX/Apache+Flex+Wiki">Wiki <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://blogs.apache.org/flex/">Blog <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Development</a>
+                    <ul>
+                        <li><a href="/dev-faq.html">Developer FAQ</a></li>
+                        <li><a href="/dev-sourcecode.html">Source Code</a></li>
+                        <li><a href="https://issues.apache.org/jira/browse/FLEX">Bug-Tracker <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#">Documentation</a>
+                    <ul>
+
+                        <li><a href="/doc-getstarted.html">Getting Started</a></li>
+                        <li><a href="/doc-videos.html">Videos</a></li>
+                        <li><a href="/asdoc/">ASDocs</a></li>
+                        <li><a href="http://help.adobe.com/en_US/flex/using/index.html">Documentation Reference (Old) <i class="icon-share icon-white"></i></a></li>
+
+                    </ul>
+                </li>
+
+                <li><a href="#">About Apache</a>
+                    <ul>
+
+                        <li><a href="http://www.apache.org">The Apache Software Foundation Website <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/contributing.html">Donations <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship <i class="icon-share icon-white"></i></a></li>
+                        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share icon-white"></i></a></li>
+                    </ul>
+                </li>
+
+                <li><a href="#" class="download">Download</a>
+                    <ul>
+
+                        <li><a href="/installer.html">Download the SDK Installer (For Application Developers)</a></li>
+                        <li><a href="/download-binaries.html">Download the SDK Binaries (For SDK Developers)</a></li>
+                        <li><a href="/download-source.html">Download the SDK Source Code (For SDK Developers)</a></li>
+                        <li><a href="/download-utilities.html">Download Utilities</a></li>
+                        <li><a href="/download-archive.html">Previous Versions</a></li>
+                    </ul>
+                </li>
+            </ul>
+
+        </div>
+        <div class="nav-shadow"></div>
+        <div class="clear"></div>
+
+    </div>
+    <!-- Navigation / End -->
+
+
+    <!-- Content -->
+
+    
+    <div class="row-fluid">
+
+
+        <!-- Page Title -->
+        <div id="page-title">
+            <h2>Unit 11 - Parameterized Tests
</h2>
+        </div>
+        <!-- Page Title / End -->
+
+
+    </div>
+    
+
+    <div class="row-fluid">
+
+
+
+<!-- Home Page Exception -->
+
+
+<p><a href="../code/unit11.zip"><img src="../images/DownloadIcon.png" alt="Download" /> Download Unit Project Files</a></p>
+<p>Much like theories, parameterized tests take a number of possible values and apply them to methods in the test case. Unlike theories, however, parameterized tests pass or fail individually, meaning that one specific data point can fail while the others pass. While Theories are best used for reversible or mathematical concepts, parameterized testing allows for passing a series of arguments and expected results to every test in a case, some tests in a case, or each to a unique test in the case.</p>
+
+<h3>Objectives:</h3>
+
+<p>After completing this lesson, you should be able to:</p>
+
+<ul>
+    <li>Create TestNG style parameterized tests</li>
+    <li>Create JUnit style parameterized tests</li>
+    <li>Use complex objects in parameterized tests</li>
+    <li>Use external data to load simple and complex objects for parameterized testing</li>
+</ul>
+
+<h3>Topics</h3>
+
+<p>In this unit, you will learn about the following topics:</p>
+
+<ul>
+    <li>Use case differences from theories</li>
+    <li>Declaring simple data for parameterization</li>
+    <li>Types of Parameterized Tests</li>
+    <li>Working with complex objects</li>
+    <li>Using external data</li>
+</ul>
+
+<h2>Use case differences from theories</h2>
+
+<p>Theories are best used for reversible operations that must succeed in every single situation. For example, a great use of a Theory might be testing a date conversion utility. Perhaps you have a class that converts dates from Gregorian calendar dates to dates on the Buddhist calendar.</p>
+
+<p>Using a theory, you would supply hundreds or thousands of Gregorian dates as data points. For each data point, you might convert the date to the equivalent Buddhist date. You would then convert each Buddhist date back to the Gregorian date and ensure it matched the original.</p>
+
+<p>With the following pseudocode:</p>
+
+<p><code><pre>[DataPoints]
+[ArrayElementType("Date")]
+public static var dates:Array = [ 1/1/2009, 
+            2/2/2010, 
+            3/3/2011, 
+            1/8/1970,
+            11/12/2090 ];</pre></code></p>
+<p>Tested under this situation</p>
+
+<p><code><pre>[Theory]
+public function shouldConvertSuccessfully( date:Date ):void {
+    var convert:Converter = new Converter();
+    var bDate:BDate = converter.convertToBuddhistDate( date );
+    var gDate:Date = converter.convertToGregorianDate( bDate );
+    assertEquals( date, gDate );
+}</pre></code></p>
+<p>This type of reversibility is the hallmark of a good theory case.</p>
+
+<p>Also, remember that Theories are about using combinations of data. Given the following pseudocode:</p>
+
+<p><code><pre>[DataPoints]
+[ArrayElementType("String")]
+public static var dates:Array = [ "Trevor", "Joe", "Rob", "Steve" ];</p>
+<p>[Theory]
+public function traceNames( name1:String, name2:String ):void {
+  trace( name1 + " - " + name2 );
+}</pre></code></p>
+<p>The expected output is:</p>
+
+<p><code><pre>Trevor - Trevor
+Trevor - Joe
+Trevor - Rob
+Trevor - Steve
+Joe - Trevor
+Joe - Joe
+Joe - Rob
+Joe - Steve
+Rob - Trevor
+Rob - Joe
+Rob - Rob
+Rob - Steve
+Steve - Trevor
+Steve - Joe
+Steve - Rob
+Steve - Steve</pre></code></p>
+<p>This use of data point combinations starkly contrasts the use case for Parameterized testing that you will learn in the remainder of the lesson.</p>
+
+<h2>Declaring simple data for parameterization</h2>
+
+<p>Parameterized test cases, like Theories, have methods that accept parameters. However, that is where the comparison ends. Parameterized testing gives us a way to create tests that will use a multitude of known parameters and results.  The intention of the Parameterized test is to eliminate the need to copy and paste the same test multiple times, simply changing the input values.</p>
+
+<p>Parameterized tests require the Parameterized runner included with FlexUnit 4.1 and later.  To use the parameterized test runner, add the RunWith metadata to the class definition.</p>
+
+<p><code><pre>[RunWith("org.flexunit.runners.Parameterized")]</pre></code></p>
+<p>Parameter data is provided as an array. Inside of the array, there is an array for each argument set to be passed for each test case.  For example:</p>
+
+<p><code><pre>public static var names:Array = [ 
+    [ "Stevens", "Mary", "Mary Stevens" ], 
+    [ "Doe", "John", "John Doe" ] ];</p>
+<p>[Test]
+public function nameCombinerTest( lastName:String, firstName:String, 
+                    expectedResult:String ):void {
+    assertEquals( expectedResult, ( firstName + " " + lastName ) );
+}</pre></code></p>
+<p>There are actually two types of Parameterized tests supported by FlexUnit 4.x, which you will learn to use next.</p>
+
+<h2>Types of parameterized test</h2>
+
+<p>To use any form of parameterized tests requires a custom runner.  FlexUnit 4.1 includes the ParameterizedRunner which can run TestNG and JUnit style parameterized tests.</p>
+
+<h3>TestNG</h3>
+
+<ul>
+    <li>Allows specification of different data for each test method</li>
+    <li>Uses the dataProvider annotation to specify the data source</li>
+    <li>Tests have expected parameters specified as part of the test</li>
+    <li>Test methods will follow the order of the data provider array</li>
+    <li>Each test can take only one data provider</li>
+</ul>
+
+<p>Example</p>
+
+<p><code><pre>public static var data:Array = [ [ 0, 0 ], [ 1, 2 ], [ 2, 4 ] ];</p>
+<p>[Test( dataProvider="data")]
+public function doubleTest( value1:int, value2:int ):void {
+    assertEquals( value1, value2 * 2 );
+}</pre></code></p>
+<h3>JUnit</h3>
+
+<ul>
+    <li>Best for data that is needed by multiple test methods</li>
+    <li>All tests will use the same data</li>
+    <li>Data must be decorated with [Parameters] metadata</li>
+    <li>Values are assigned in the constructor</li>
+    <li>Instance variables are used to store each value</li>
+    <li>Test methods take no arguments</li>
+</ul>
+
+<p>Example</p>
+
+<p><code><pre>[Parameters]
+public static var data:Array = [ [ 0, 0 ], [ 1, 2 ], [ 2, 4 ] ];</p>
+<p>[Test]
+public function doubleTest():void {
+    assertEquals( value1, value2 * 2 );
+}</p>
+<p>private var _value1:int;
+private var _value2:int;</p>
+<p>public function JUnitStyleTest( value1:int, value2:int ) {
+    _value1 = value1;
+    _value2 = value2;
+}</pre></code></p>
+<h2>Working with complex objects</h2>
+
+<p>Any type of data can be used in parameterized testing. In fact, some of the most effective testing can occur when you begin using entire objects as the parameters to methods. The following examples are all valid and intended to make you consider how polymorphism and complex types can enhance your testing capabilities.</p>
+
+<p><code><pre>public static var data:Array = [ [ new DataGrid(), 50, 70 ],
+                [ new Label(), 40, 30 ],
+                [ new Button(), 80, 50 ] ];</p>
+<p>[Test(dataProvider="data")]
+public function positionTest( component:UIComponent, x:Number, y:Number ):void {
+    position( component );
+    assertEquals( x, component.x );
+    assertEquals( y, component.y );
+}</p>
+<p>public static var data:Array = [ [ new DollarFormatter(), 50, "$50" ],
+            [ new EuroFormatter(), 50, "&euro;50" ],
+            [ new PoundFormatter(), 50, "&pound;50" ] ];</p>
+<p>[Test(dataProvider="data")]
+public function positionTest( formatter:IFormatter, value:Number, result:String ):void {
+    assertEquals( result, formatter.format( value ) );
+}</pre></code></p>
+<h2>Walkthrough 1: Creating a TestNG Style Parameterized Test</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Create a new class to run tests with parameterized data.</li>
+    <li>Apply the TestNG style of parameterized testing.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Import the FlexUnit4Training_wt1.fxp project from the Unit 11/Start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+    </li>
+    <li>
+        <p>Create a new ActionScript class named GetPointsTest.as in the math.testcases package within the tests folder.</p>
+
+        <h3><br />Parameterized Testing Setup</h3>
+
+    </li>
+    <li>
+        <p>Mark the GetPointsTest class definition with <code>[RunWith("org.flexunit.runners.Parameterized")]</code> metadata.</p>
+
+<code><pre>[RunWith("org.flexunit.runners.Parameterized")]
+public class GetPointsTest {
+...
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Add a private static constant named <code>TOLERANCE</code> of data type <code>Number</code> to the class. Set <code>TOLERANCE</code> to <code>.0001</code>.</p>
+
+        <code><pre>private static const TOLERANCE:Number = .0001;</pre></code>
+
+    </li>
+    <li>
+        <p>Declare a public static array named data within the <code>GetPointsTest</code> class. The array should contain a sub array with point values as shown.</p>
+
+<code><pre>public static var data:Array = [
+        [ new Circle( new Point( 0, 0 ), 5 ), new Point( 5, 0 ), 0 ],
+        [ new Circle( new Point( 0, 0 ), 5 ), new Point( -5, 0 ), Math.PI ] 
+];</pre></code>
+
+<p>If you did not use code-completion, add the import for net.digitalprimates.math.Circle and flash.geom.Point at this time.</p>
+<p>The data array contains two arrays. Each is passed as a set of parameters, and each represents one run cycle for the tests that take the data. Soon, you will write a method which takes 3 parameters, a circle, a point and a number of radians.  That test will run twice, one run using the first array and another using the second.</p>
+    </li>
+    <li>
+        <p>Add a public method named <code>shouldGetPointsOnCircle()</code> to the class. Mark the method with the <code>[Test(dataProvider="data")]</code> metadata.</p>
+
+<code><pre>[Test(dataProvider="data")]
+public function shouldGetPointsOnCircle():void {
+}</pre></code>
+
+        <p>Add a <code>circle</code> parameter of type <code>Circle</code>, a point parameter of type <code>Point</code>, and a <code>radians</code> parameter of type <code>Number</code> to the <code>shouldGetPointsOnCircle()</code> method.</p>
+        <p>The <code>[Test(dataProvider="data")]</code> metadata over the test method will ensure that the data array's values get passed in as the test method's arguments. This is known as TestNG style parameterized testing, because the data is passed into specific test methods via the metadata. TestNG is a testing framework for Java, it pioneered this annotations-based approach.</p>
+
+<code><pre>[Test(dataProvider="data")]
+public function shouldGetPointsOnCircle( circle:Circle, point:Point, radians:Number ):void {
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Add a call to the <code>assertThat()</code> method. Pass <code>circle.getPointOnCircle( radians )</code> and <code>new CloseToPointMatcher( point, TOLERANCE )</code> as its arguments.</p>
+
+<code><pre>[Test(dataProvider="data")]
+public function shouldGetPointsOnCircle( circle:Circle, point:Point, radians:Number ):void {
+    assertThat( circle.getPointOnCircle( radians ), new CloseToPointMatcher( point, TOLERANCE ) );
+}</pre></code>
+
+        <p>If you did not use code-completion, add the imports for org.flexunit.assertThat and matcher.CloseToPointMatcher at this time.</p>
+        <p>The <code>shouldGetPointsOnCircle()</code> method uses the <code>assertThat()</code> statement with the <code>CloseToPointMatcher</code> to create the same kind of test coverage presented in BasicCircleTest class through the <code>shouldGetTopPointOnCircle()</code> and <code>shouldGetBottomPointOnCircle()</code> methods.</p>
+    </li>
+    <li>
+        <p>Save the GetPointsTest.as file.</p>
+
+        <h3><br />Add the new case to the CircleSuite</h3>
+
+    </li>
+    <li>
+        <p>Open the CircleSuite.as file in the math.testcases package.</p>
+    </li>
+    <li>
+        <p>Add a public variable named <code>test6</code> of type <code>GetPointsTest</code>.</p>
+
+<code><pre>[Suite]
+[RunWith("org.flexunit.runners.Suite")]
+public class CircleSuite{
+    public var test1:BasicCircleTest;
+    public var test2:CircleConstructorTest;
+    public var test3:CircleTheory;
+    public var test4:CircleMockTest;
+    public var test5:DistanceTest;
+    public var test6:GetPointsTest;
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Save CircleSuite.as.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit11/image1.png' />
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+    </li>
+</ol>
+
+<h2>Walkthrough 2: Creating a JUnit Style Parameterized Test</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Add another parameterized test to the GetPointsTest class.</li>
+    <li>Apply the JUnit style of parameterized testing.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the GetPointsTest.as file located in the math.testcases package within the tests folder.</p>
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt2.fxp project from the Unit11/ start folder. Please refer to Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Add Instance variables</h3>
+
+    </li>
+    <li>
+        <p>Add three private variables to the <code>GetPointsTest</code> class. One named <code>circle</code> of type <code>Circle</code>, another named <code>point</code> of type <code>Point</code>, and another named <code>radians</code> of type <code>Number</code>.</p>
+
+<code><pre>private var circle:Circle;
+private var point:Point;
+private var radians:Number;</pre></code>
+
+    </li>
+    <li>
+        <p>Remove the <code>(dataProvider="data")</code> portion of the metadata from the <code>shouldGetPointsOnCircle()</code> test method. Also remove the parameters, as they will be replaced by the instance variables just created.</p> 
+
+<code><pre>[Test(dataProvider="data")]
+public function shouldGetPointsOnCircle( circle:Circle, point:Point, radians:Number ):void {
+...
+}</pre></code>
+
+        <p>Becomes</p>
+
+<code><pre>[Test]
+public function shouldGetPointsOnCircle():void {
+...
+}</pre></code>
+
+        <h3><br />Add a method to test point distance</h3>
+
+    </li>
+    <li>
+        <p>Add a public function named <code>shouldReturnDistanceEqualToRadius()</code> to the class.</p>
+
+<code><pre>[Test]
+public function shouldReturnDistanceEqualToRadius():void {
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Within the new method, declare a variable named <code>distance</code> of data type <code>Number</code>. Set it equal to <code>Point.distance( circle.getPointOnCircle( radians ), circle.origin )</code>.</p>
+
+<code><pre>[Test]
+public function shouldReturnDistanceEqualToRadius():void {
+    var distance:Number = Point.distance( circle.getPointOnCircle( radians ), circle.origin );
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Add a call to the <code>assertThat()</code> method. Pass in <code>distance</code> and <code>equalTo( circle.radius )</code> as its arguments.</p>
+
+<code><pre>[Test]
+public function shouldReturnDistanceEqualToRadius():void {
+    var distance:Number = Point.distance( circle.getPointOnCircle( radians ), circle.origin );
+
+    assertThat( distance, equalTo( circle.radius ) );
+}</pre></code>
+
+        <p>If you did not use code-completion, add the import for org.hamcrest.object.equalTo at this time.</p>
+    </li>
+    <li>
+        <p>Now you will need to create a class constructor function that assigns the parameters to the variables declared above. It will take in a circle , point, and radians parameters and assign it to the instance variable for each.</p>
+
+<code><pre>public function GetPointsTest( circle:Circle, point:Point, radians:Number ) {
+    this.circle = circle;
+    this.point = point;
+    this.radians = radians;
+}</pre></code>
+
+    </li>
+    <li>
+        <p>Mark the data array with <code>[Parameters]</code> metadata.</p>
+
+<code><pre>[Parameters]
+public static var data:Array = 
+[ [ new Circle( new Point( 0, 0 ), 5 ), new Point( 5, 0 ), 0 ],
+  [ new Circle( new Point( 0, 0 ), 5 ), new Point( -5, 0 ), Math.PI ] ];</pre></code>
+
+        <p>In the previous walkthrough, parameters were passed in using the <code>dataProvider="data"</code> metadata. In this case, parameters are marked with <code>[Parameters]</code> metadata, which passes them into the constructor before each test method is run. This is the parameterized testing approach used in JUnit, a popular Java Unit testing framework on which FlexUnit bases much of its syntax.</p>
+    </li>
+    <li>
+        <p>Save GetPointsTest.as.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit11/image2.png' /> 
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+    </li>
+</ol>
+
+<h2>Using external data</h2>
+
+<p>External data for parameterized testing is similar to external data in theories. All external data sources use a dataloader, which must implement the IExternalDependancyLoader interface.</p>
+
+<p><code><pre>public static var dataRetriever:IExternalDependencyLoader = new ParamDataHelper( "myUrl" );</pre></code></p>
+<p>Depending on the style, the loading method for data is different:</p>
+
+<h3>TestNG</h3>
+
+<ul>
+    <li>Similar to theories</li>
+    <li>Set a DataPoints variable and annotate it with the loader property</li>
+</ul>
+
+<p><code><pre>[DataPoints(loader="dataRetriever")]
+public static var data:Array;</pre></code></p>
+<h3>JUnit</h3>
+
+<ul>
+    <li>Loader is added as an annotation to the [Parameters]</li>
+</ul>
+
+<p><code><pre>[Parameters(loader="dataRetriever")]
+public static var data:Array;</pre></code></p>
+<p>For more info on loading external data, see Unit 9: External Data.</p>
+
+<h2>Walkthrough 3: Loading External Parameters</h2>
+
+<p>In this walkthrough you will perform the following tasks:</p>
+
+<ul>
+    <li>Load parameterized data from an external XML file.</li>
+    <li>Apply externally loaded parameters for greater test coverage.</li>
+</ul>
+
+<h3>Steps</h3>
+
+<ol>
+    <li>
+        <p>Open the GetPointsTest.as file you created in the previous exercise.</p> 
+        <p>Alternatively, if you didn't complete the previous lesson or your code is not functioning properly, you can import the FlexUnit4Training_wt3.fxp project from the Unit 11/Start folder. Please refer to Unit 2: Walkthrough 1Unit 2: Walkthrough 1 for instructions on importing a Flash Builder project.</p>
+
+        <h3><br />Add the external data loader</h3>
+
+    </li>
+    <li>
+        <p>Add a public static variable named <code>getDataPointsLoader</code> of type <code>GetPointsDataHelper</code> to the <code>GetPointsTest</code> class. Instantiate the <code>GetPointsDataHelper</code> passing it a the argument <code>"xml/circlePoints.xml"</code></p>
+
+        <code><pre>public static var getDataPointsLoader:GetPointsDataHelper =
+ new GetPointsDataHelper( "xml/circlePoints.xml" );</pre></code>
+
+        <p>If you did not use code-completion, add the import for helper.GetPointsDataHelper at this time.</p>
+        <p>The GetPointsDataHelper class implements IExternalDependencyLoader and IResponder interfaces. It is able to send and receive a data request in test case preparation. The loader itself references a data provider. In a parameterized test case, a static array uses these test parameters.</p>
+    </li>
+    <li>
+        <p>Remove the static values from the data Array and modify the <code>[Parameters]</code> metadata to include a loader <code>[Parameters(loader="getDataPointsLoader")]</code> metadata. It should read as follows:</p>
+
+<code><pre>[Parameters(loader="getDataPointsLoader")]
+public static var data:Array</pre></code>
+
+    </li>
+    <li>
+        <p>Save the GetPointsTest.as file.</p>
+    </li>
+    <li>
+        <p>Run the FlexUnit4Training.mxml file.</p>
+        <p>If FlexUnit4Training.mxml ran successfully you should see the following output in your browser window:</p>
+
+        <img alt='TestsPassed' id='shift' src='../images/unit11/image3.png' /> 
+        <p class='caption' id='shift'>Figure 1: FlexUnit tests passed</p>
+
+        <p>The reason that the number of tests rose significantly in this Walkthrough is because FlexUnit logs a test for each parameter set being tested. As a result, four tests have been added to the reporting window, and each represents a parameter in the circlePoints.xml file</p>
+    </li>
+</ol>
+
+<h2>Summary</h2>
+
+<ul>
+    <li><p>The use case of Parameterized testing and Theories is different.</p></li>
+    <li><p>Parameterized tests pass entire sets of arguments to a method. Theories define possible combinations.</p></li>
+    <li><p>Parameterized require the RunWith metadata <code>[RunWith("org.flexunit.runners.Parameterized")]</code>.</p></li>
+    <li><p>Public static arrays containing arrays of arguments feed data into test methods and constructors depending on the style.</p></li>
+    <li><p>Two types of Parameterized testing: TestNG and JUnit.</p></li>
+    <li><p>TestNG Style - Declares a dataProvider per test method, therefore allowing different tests to use different data.</p></li>
+    <li><p>JUnit Style - Instantiates parameterized data to instance variables within the class constructor.</p></li>
+    <li><p>Complex objects can be passed as parameterized data. </p></li>
+    <li><p>External data can be loaded for parameterized testing with a custom loader.</p></li>
+    <ul> 
+        <li><p>The loader classes used for parameterized testing are created in exact same way as those used for theories.</p></li>
+    </ul>
+</ul>
+
+<h2>Navigation</h2>
+
+<ul>
+    <li><a href="Unit-10.html">Unit 10 - Mock Classes</a></li>
+    <li><a href="Unit-12.html">Unit 12 - Running Tests from Different Versions</a></li>
+    <li><a href="../index.html">Table of Contents / Introduction</a></li>
+</ul>
+
+<!-- Home Page Exception -->
+
+
+
+
+</div></div>
+<!-- Wrapper / End -->
+
+
+<!-- Footer -->
+
+<!-- Footer Top -->
+<div id="footer" class="container-fluid paddingbottom" >
+
+
+    <div class="row-fluid">
+
+        <!-- About -->
+        <div class="span3">
+            <div class="footer-headline"><h4>About Us</h4></div>
+            <p>Apache Flex® is a highly productive, open source application framework for building and maintaining expressive web applications that deploy consistently on all major browsers, desktops and devices (including smartphones, tablets and tv). It provides a modern, standards-based language and programming model that supports common design patterns suitable for developers from many backgrounds. Flex applications can be deployed to the ubiquitous Adobe® Flash® Player in the browser, Adobe® AIR™ on desktop and mobile or to native Android™, IOS™, QNX®, Windows® or Mac® applications.</p>
+        </div>
+
+        <!-- Subscribe  -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Subscribe</h4></div>
+            <p>We have two mailing lists, one for SDK developers, and one for SDK users.</p>
+            <p>Developers, send an email to <br>
+                <a href="mailto:dev-subscribe@flex.apache.org">dev-subscribe@flex.apache.org</a>
+            </p>
+            <p>Users, send an email to <br>
+                <a href="mailto:users-subscribe@flex.apache.org">users-subscribe@flex.apache.org</a>
+            </p>
+        </div>
+
+        <!-- Latest Releases -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Releases</h4></div>
+            <p>Apache Flex SDK : <a href="/download-binaries.html">4.12.0 (Mar 2014)</a><br />
+                SDK Installer : <a href="/installer.html">2.7.0 (Oct 2013)</a><br />
+                BlazeDS : <a href="http://sourceforge.net/adobe/blazeds/wiki/Home/">4.6.0 (Nov 2011)</a><br />
+                Flex Mavenizer : <a href="http://svn.apache.org/viewvc/flex/utilities/trunk/mavenizer/"> 4.8.0 (Jan 2013)</a></p>
+        </div>
+
+        <!-- Latest Tweets -->
+        <div class="span3">
+            <div class="footer-headline"><h4>Latest Tweets</h4></div>
+            <a class="twitter-timeline" href="https://twitter.com/ApacheFlex" data-chrome="noheader nofooter noborders noscrollbar" data-widget-id="364567612920852480">Tweets by Apache Flex</a>
+            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
+            <div class="clear"></div>
+        </div>
+
+    </div>
+
+</div>
+<!-- Footer / Bottom -->
+<div id="footer" class="container-fluid" style="background: #111;">
+    <div class="row-fluid">
+        <div class="span12">
+            <div id="footer-bottom">
+                Copyright © 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0 <br>
+                Apache Flex, Apache and the Apache feather logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+                Read more about our privacy policy on our <a href="about-privacy.html">Privacy Policy</a> page.
+                <div id="scroll-top-top"><a href="#" title="Go to Top"></a></div>
+            </div>
+        </div>
+    </div>
+
+</div>
+
+<!-- Footer / End -->
+
+</body>
+
+</html>
\ No newline at end of file