@@ -0,0 +1,1824 @@
+/*%0A * Copyright 2010-2011, Sikuli.org%0A * Released under the MIT License.%0A *%0A */%0Apackage org.sikuli.script;%0A%0Aimport org.junit.* ;%0Aimport static org.junit.Assert.* ;%0A%0Aimport java.io.*;%0Aimport javax.imageio.*;%0A%0Apublic class ImageLocatorTest %0A%7B%0A    @Test%0A    public void test_existing_local_img() throws Exception%0A    %7B%0A       ImageLocator locator = new ImageLocator();%0A       locator.addImagePath(%22test-res%22);%0A       String fname = locator.locate(%22network.png%22);%0A       assertTrue((new File(fname)).exists());%0A    %7D%0A%0A    @Test(expected=FileNotFoundException.class)%0A    public void test_not_existing_local_img() throws Exception%0A    %7B%0A       ImageLocator locator = new ImageLocator();%0A       String fname = locator.locate(%22some-not-exist-image.png%22);%0A    %7D%0A%0A    @Test%0A    public void test_existing_remote_img() throws Exception%0A    %7B%0A       ImageLocator locator = new ImageLocator();%0A       try%7B%0A          String fname = locator.locate(%22apple.png%22);%0A          for(String path:locator.getImagePath())%0A             locator.removeImagePath(path);%0A          fname = locator.locate(%22apple.png%22);%0A          fail(%22locator should throw FileNotFoundException, not %22 + fname);%0A       %7D%0A       catch(FileNotFoundException e)%7B%0A         assertNotNull(e);%0A       %7D%0A       String url = %22http://sikuli.org/examples/clickapple.sikuli%22;%0A       locator.addImagePath(url);%0A       String fname = locator.locate(%22apple.png%22);%0A       assertTrue((new File(fname)).exists());%0A    %7D%0A%0A    @Test%0A    public void test_cache() throws Exception%0A    %7B%0A       String url = %22http://sikuli.org/examples/clickapple.sikuli%22;%0A       ImageLocator locator = new ImageLocator();%0A       locator.addImagePath(url);%0A       String fname = locator.locate(%22apple.png%22);%0A       String fname2 = locator.locate(url+%22/apple.png%22);%0A       assertEquals(fname, fname2);%0A    %7D%0A%0A%7D%0A%0A%0A%0A

add test for ImageLocator