Anonymous avatar Anonymous committed 7072c28

in order to fix autoassign issue I create seaprate Mockito instance for each test

Comments (0)

Files changed (4)

mockito/mockito.iml

   <component name="Flex.Build.Configuration">
     <option name="DO_BUILD" value="true" />
     <option name="OUTPUT_TYPE" value="Library" />
-    <option name="APPLICATION_ENTRY_POINT" value="mockito/src/main/flex/HelloWorld.mxml" />
+    <option name="MAIN_CLASS" value="HelloWorld" />
     <option name="OUTPUT_FILE_NAME" value="mockito.swc" />
+    <option name="TARGET_PLAYER_VERSION" value="9.0.124" />
     <option name="STATIC_LINK_RUNTIME_SHARED_LIBRARIES" value="false" />
     <option name="ADDITIONAL_COMPILER_OPTIONS" value="-keep-as3-metadata Mock" />
-    <option name="VERSION" value="2" />
+    <option name="VERSION" value="3" />
   </component>
   <component name="NewModuleRootManager" inherit-compiler-output="false">
     <output url="file://$MODULE_DIR$/../out/production" />

mockito/src/main/flex/org/mockito/integrations/flexunit4/MockitoClassRunner.as

 public class MockitoClassRunner extends BlockFlexUnit4ClassRunner
 {
     private var _testClass:Class;
-    private var _mockito:MockCreator;
 
     public function MockitoClassRunner(testClass:Class)
     {
         super(testClass);
         _testClass = testClass;
-        currentMockito = new Mockito();
-        _mockito = currentMockito;
     }
 
     protected override function withBefores(method:FrameworkMethod, target:Object):IAsyncStatement
     {
         var sequencer:StatementSequencer = new StatementSequencer();
-
+        currentMockito = new Mockito();
         sequencer.addStep(withMocksAssignment(_testClass, target));
         sequencer.addStep(super.withBefores(method, target));
 
 
     private function withMocksAssignment(testClass:Class, target:Object):IAsyncStatement
     {
-        return new AssignMocks(_mockito, testClass, target);
+        return new AssignMocks(currentMockito, testClass, target);
     }
 
     protected override function withBeforeClasses():IAsyncStatement
 
     protected function withMocksPreparation(testClass:Class):IAsyncStatement
     {
-        return new PrepareMocks(_mockito, testClass);
+        return new PrepareMocks(new Mockito(), testClass);
     }
 }
 }

mockito_tests/mockito_tests.iml

         <option name="USE_DEFAULT_SDK_CONFIG_FILE" value="true" />
         <option name="USE_CUSTOM_CONFIG_FILE" value="false" />
         <option name="CUSTOM_CONFIG_FILE" value="" />
-        <option name="APPLICATION_ENTRY_POINT" value="mockito_tests/src/main/flex/UnitTests.mxml" />
+        <option name="USE_CUSTOM_CONFIG_FILE_FOR_TESTS" value="false" />
+        <option name="CUSTOM_CONFIG_FILE_FOR_TESTS" value="" />
+        <option name="APPLICATION_ENTRY_POINT" value="" />
+        <option name="MAIN_CLASS" value="UnitTests" />
         <option name="OUTPUT_FILE_NAME" value="MockitoTests.swf" />
         <option name="USE_FACET_COMPILE_OUTPUT_PATH" value="false" />
         <option name="FACET_COMPILE_OUTPUT_PATH" value="" />
+        <option name="INCLUDE_RESOURCE_FILES_IN_SWC" value="false" />
+        <option name="TARGET_PLAYER_VERSION" value="" />
         <option name="STATIC_LINK_RUNTIME_SHARED_LIBRARIES" value="true" />
         <option name="USE_LOCALE_SETTINGS" value="false" />
         <option name="LOCALE" value="en_US" />
         <option name="ADDITIONAL_COMPILER_OPTIONS" value="" />
-        <option name="VERSION" value="0" />
+        <option name="VERSION" value="3" />
         <option name="PATH_TO_SERVICES_CONFIG_XML" value="" />
         <option name="CONTEXT_ROOT" value="" />
-        <SERVER_TECHNOLOGY value="None" />
         <NAMESPACE_AND_MANIFEST_FILE_INFO_LIST />
+        <CONDITIONAL_COMPILATION_DEFINITION_LIST />
       </configuration>
     </facet>
     <facet type="flex" name="FlexUnit4">
         <option name="USE_DEFAULT_SDK_CONFIG_FILE" value="true" />
         <option name="USE_CUSTOM_CONFIG_FILE" value="false" />
         <option name="CUSTOM_CONFIG_FILE" value="" />
-        <option name="APPLICATION_ENTRY_POINT" value="mockito_tests/src/main/flex/FlexUnit4Tests.mxml" />
+        <option name="USE_CUSTOM_CONFIG_FILE_FOR_TESTS" value="false" />
+        <option name="CUSTOM_CONFIG_FILE_FOR_TESTS" value="" />
+        <option name="APPLICATION_ENTRY_POINT" value="" />
+        <option name="MAIN_CLASS" value="FlexUnit4Tests" />
         <option name="OUTPUT_FILE_NAME" value="FlexUnit4.swf" />
         <option name="USE_FACET_COMPILE_OUTPUT_PATH" value="false" />
         <option name="FACET_COMPILE_OUTPUT_PATH" value="" />
+        <option name="INCLUDE_RESOURCE_FILES_IN_SWC" value="false" />
+        <option name="TARGET_PLAYER_VERSION" value="9.0.0" />
         <option name="STATIC_LINK_RUNTIME_SHARED_LIBRARIES" value="true" />
         <option name="USE_LOCALE_SETTINGS" value="false" />
         <option name="LOCALE" value="en_US" />
         <option name="ADDITIONAL_COMPILER_OPTIONS" value="" />
-        <option name="VERSION" value="0" />
+        <option name="VERSION" value="3" />
         <option name="PATH_TO_SERVICES_CONFIG_XML" value="" />
         <option name="CONTEXT_ROOT" value="" />
-        <SERVER_TECHNOLOGY value="None" />
         <NAMESPACE_AND_MANIFEST_FILE_INFO_LIST />
+        <CONDITIONAL_COMPILATION_DEFINITION_LIST />
       </configuration>
     </facet>
   </component>
   <component name="Flex.Build.Configuration">
     <option name="DO_BUILD" value="true" />
-    <option name="APPLICATION_ENTRY_POINT" value="$MODULE_DIR$/src/main/flex/UnitTests.mxml" />
+    <option name="MAIN_CLASS" value="UnitTests" />
     <option name="OUTPUT_FILE_NAME" value="mockito_tests.swf" />
-    <option name="VERSION" value="2" />
+    <option name="TARGET_PLAYER_VERSION" value="9.0.124" />
+    <option name="VERSION" value="3" />
   </component>
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
     <orderEntry type="module-library">
       <library name="AUTOGENERATED library equal to Flex SDK 3.2.0_3958">
         <CLASSES>
-          <root url="jar://$MODULE_DIR$/../../../java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/libs/player/9/playerglobal.swc!/" />
+          <root url="jar://C:/java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/libs/player/9/playerglobal.swc!/" />
         </CLASSES>
         <JAVADOC />
         <SOURCES>
-          <root url="file://$MODULE_DIR$/../../../java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/projects/framework/src" />
-          <root url="file://$MODULE_DIR$/../../../java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/projects/rpc/src" />
+          <root url="file://C:/java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/projects/framework/src" />
+          <root url="file://C:/java/css-ui-sdk/workspace/environment/sdk/3.2.0_3958/frameworks/projects/rpc/src" />
         </SOURCES>
       </library>
     </orderEntry>

mockito_tests/src/main/flex/FlexUnit4Tests.mxml

         import org.mockito.integrations.flexunit4.MockPreparationWoAssignment;
         import org.mockito.integrations.flexunit4.MockingWithFlexUnit4;
         import org.mockito.integrations.flexunit4.MockitoClassRunner;
+        import org.mockito.integrations.flexunit4.UsingAutoassignedMocks;
 
         private var core:FlexUnitCore = new FlexUnitCore();
 
         private function startupTests():void
         {
             core.addListener(new UIListener(uiListener));
-            core.run(MockAssignment, MockingWithFlexUnit4, MockPreparationWoAssignment);
+            core.run(MockAssignment, MockingWithFlexUnit4, MockPreparationWoAssignment, UsingAutoassignedMocks);
         }
 
         private var imports:Array = [MockitoClassRunner];
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.