/*
 * Copyright 2010-2011, Sikuli.org
 * Released under the MIT License.
 *
 */
package org.sikuli.script;

import org.junit.* ;
import static org.junit.Assert.* ;
import static org.mockito.Mockito.*;
import org.mockito.stubbing.Answer;
import org.mockito.invocation.InvocationOnMock;


import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.Rectangle;
import java.io.File;

public class RegionFastTest 
{
   private int DESKTOP_X = 0, DESKTOP_Y = 0, DESKTOP_W = 1680, DESKTOP_H = 1050;
   private Rectangle DESKTOP_RECT = new Rectangle(DESKTOP_X, DESKTOP_Y, DESKTOP_W, DESKTOP_H);

   @Test
   public void test_doFind() throws Exception {
      BufferedImage desktop_img = ImageIO.read(new File("test-res/mac-desktop.png"));
      ScreenImage desktop_simg = new ScreenImage(DESKTOP_RECT, desktop_img);

      Screen scr = spy(new Screen());
      doReturn(scr).when(scr).getScreen();
      doReturn(desktop_simg).when(scr).capture(anyInt(), anyInt(), anyInt(), anyInt());

      Match m = scr.doFind("test-res/network.png");
      assertEquals(m.x, 792);
      assertEquals(m.y, 391);
      assertEquals(m.w, 52);
      assertEquals(m.h, 54);
   }
}


@@ -430,23 +430,32 @@
 t %0A%7B%0A   
-priva
+static protec
 te
+d
  int DES
@@ -524,15 +524,24 @@
 %0A   
-private
+static protected
  Rec
@@ -629,40 +629,93 @@
 %0A   
-@Test%0A   public void test_doFind
+static protected Screen _mockScr;%0A%0A   @BeforeClass static public void setupMockScreen
 () t
@@ -729,17 +729,16 @@
 xception
- 
 %7B%0A      
@@ -905,16 +905,14 @@
     
-Screen s
+_mockS
 cr =
@@ -946,17 +946,22 @@
 oReturn(
-s
+_mockS
 cr).when
@@ -957,25 +957,30 @@
 ckScr).when(
-s
+_mockS
 cr).getScree
@@ -1018,17 +1018,22 @@
 g).when(
-s
+_mockS
 cr).capt
@@ -1077,16 +1077,78 @@
 Int());%0A
+   %7D%0A%0A   @Test%0A   public void test_doFind() throws Exception %7B
 %0A      M
@@ -1156,17 +1156,22 @@
 tch m = 
-s
+_mockS
 cr.doFin

add a setup method setupMockScreen in RegionFastTest