package com.warrenstrange.googleauth;


import org.junit.Test;

/*
 * Not really a unit test- but it shows usage
 */
public class GoogleAuthTest {

    @Test
    public void genSecretTest() {
        GoogleAuthenticator gauth = new GoogleAuthenticator();

        final GoogleAuthenticatorKey key = gauth.generateSecretKey();
        final String secret = key.getKey();

        String url = GoogleAuthenticatorKey.getQRBarcodeURL("testuser", "testhost", secret);

        System.out.println("Please register " + url);
        System.out.println("Secret key is " + secret);
    }


    // Change this to the saved secret from the running the above test.
    static String savedSecret = "VV5OVNP4S42DQSS3";

    @Test
    public void authTest() {
        // enter the code shown on device. Edit this and run it fast before the code expires!
        int code = 863311;

        GoogleAuthenticator ga = new GoogleAuthenticator();
        ga.setWindowSize(5);  //should give 5 * 30 seconds of grace...

        boolean r = ga.authorize(savedSecret, code);

        System.out.println("Check code = " + r);
    }


}

package com.warrenstrange.googleauth;


import org.junit.Test;

/**
 * Not really a unit test, but it shows the basic usage of this package.
 * To properly test the authenticator, manual intervention and multiple steps
 * are required:
 * <ol>
 * <li>Run the test in order to generate the required information for a
 * Google Authenticator application to be configured.</li>
 * <li>Set the <code>savedSecret</code> field with the value generated by the
 * <code>GoogleAuthTest#genSecretTest</code> method.</li>
 * <li>Generate the current code with the Google Authenticator application and
 * set the <code>currentCode</code> accordingly.</li>
 * <li>Check that the <code>#authTest</code> method correctly validates the
 * data when invoking the <code>GoogleAuthenticator#authorize</code> method.
 * </li>
 * </ol>
 */
public class GoogleAuthTest {

    // Change this to the saved secret from the running the above test.
    private static String savedSecret = "VV5OVNP4S42DQSS3";
    private static int currentCode = 863311;

    @Test
    public void genSecretTest() {
        GoogleAuthenticator googleAuthenticator = new GoogleAuthenticator();

        final GoogleAuthenticatorKey key =
                googleAuthenticator.generateSecretKey();
        final String secret = key.getKey();

        String url = GoogleAuthenticatorKey.getQRBarcodeURL(
                "testuser", "testhost", secret);

        System.out.println("Please register " + url);
        System.out.println("Secret key is " + secret);
    }

    @Test
    public void authTest() {
        GoogleAuthenticator ga = new GoogleAuthenticator();
        ga.setWindowSize(5);  //should give 5 * 30 seconds of grace...

        boolean r = ga.authorize(savedSecret, currentCode);

        System.out.println("Check currentCode = " + r);
    }


}

Update the test class and properly document it.