package com.deque;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.json.JSONObject;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.Map;
import java.util.concurrent.TimeUnit;

public class KensingtonTest
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public KensingtonTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( KensingtonTest.class );
    }


    public void testAccessibility()
    {
        WebDriver driver = new FirefoxDriver();
        driver.get(TestHelper.getUrl());

        TestHelper.injectScript(driver);

        driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
        Object response = ((JavascriptExecutor)driver).executeAsyncScript(
                "var callback = arguments[arguments.length - 1];\n" +
                "dqre.a11yCheck(document, null, callback);");
        JSONObject responseJSON = new JSONObject((Map) response);
        int violationCount = responseJSON.getJSONArray("violations").length(); 
        if (violationCount == 1) {
            assertTrue("No violations found", true);
        } else {
            assertTrue(Integer.toString(violationCount) + " violations found", false);
        }

        driver.quit();
    }
}

@@ -540,20 +540,16 @@
 gtonTest
-%0A   
  extends
@@ -560,16 +560,44 @@
 tCase%0A%7B%0A
+%09private WebDriver driver;%0A%0A
     /**%0A
@@ -930,21 +930,17 @@
 %0A    %7D%0A%0A
-%0A    
+%09
 public v
@@ -947,81 +947,144 @@
 oid 
-testAccessibility()%0A    %7B%0A        WebDriver driver = new FirefoxDriver();
+setUp()%0A%09%7B%0A%09%09driver = new FirefoxDriver();%0A%09%7D%0A%0A%09public void tearDown()%0A%09%7B%0A%09%09driver.quit();%0A%09%7D%0A%0A    public void testAccessibility()%0A    %7B
 %0A   
@@ -1797,32 +1797,8 @@
    %7D
-%0A%0A        driver.quit();
 %0A   

Add setup/teardown to Java test example