package nl.hsac.fitnesse.sample;

import nl.hsac.fitnesse.fixture.slim.web.BrowserTest;
import nl.hsac.fitnesse.fixture.slim.web.annotation.TimeoutPolicy;
import nl.hsac.fitnesse.fixture.slim.web.annotation.WaitUntil;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Fixture class customized to test funda.nl.
 */
public class FundaTest extends BrowserTest {
    private static final Pattern COUNT_PATTERN = Pattern.compile("(\\d+)");
    @WaitUntil(TimeoutPolicy.RETURN_NULL)
    public Integer numberOfPhotos() {
        Integer count = null;
        String countText = valueOf("xpath=//span[@class='object-media-teaser-count']");
        if (countText != null) {
            Matcher m = COUNT_PATTERN.matcher(countText);
            if (m.matches()) {
                String counterStr = m.group(1);
                count = Integer.valueOf(counterStr);
            }
        }
        return count;
    }
}

@@ -216,73 +216,8 @@
 l;%0A%0A
-import java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0A
 /**%0A
@@ -315,84 +315,8 @@
 t %7B%0A
-    private static final Pattern COUNT_PATTERN = Pattern.compile(%22(%5C%5Cd+)%22);%0A
     
@@ -364,23 +364,22 @@
  public 
-Integer
+String
  numberO
@@ -402,56 +402,14 @@
     
-Integer count = null;%0A        String countText =
+return
  val
@@ -470,277 +470,8 @@
 %22);%0A
-        if (countText != null) %7B%0A            Matcher m = COUNT_PATTERN.matcher(countText);%0A            if (m.matches()) %7B%0A                String counterStr = m.group(1);%0A                count = Integer.valueOf(counterStr);%0A            %7D%0A        %7D%0A        return count;%0A
     

Simplify FundaTest fixture