@Test
public void finishRegistrationShouldDetectIncorrectChallenge() throws Exception {

    expectedException.expectCause(isA(U2fBadInputException.class));
    RegisterRequest registerRequest = new RegisterRequest(SERVER_CHALLENGE_REGISTER_BASE64, APP_ID_ENROLL);
    String clientDataBase64 = U2fB64Encoding.encode("{\"typ\":\"navigator.id.finishEnrollment\",\"challenge\":\"ARGHABLARGHLER\",\"origin\":\"http://example.com\"}".getBytes("UTF-8"));
    u2f.finishRegistration(
        registerRequest,
        new RegisterResponse(
            TestVectors.REGISTRATION_DATA_BASE64,
            clientDataBase64
        )
    );
    fail("finishRegistration did not detect incorrect challenge");
}