@Test
public void finishRegistrationShouldReturnAMatchedDevice() throws Exception {

    DeviceRegistration deviceRegistration = new DeviceRegistration(KEY_HANDLE_BASE64, USER_PUBLIC_KEY_SIGN_HEX, ATTESTATION_CERTIFICATE, 0);
    DeviceRegistration deviceRegistration2 = new DeviceRegistration(KEY_HANDLE_BASE64, USER_PUBLIC_KEY_SIGN_HEX, ATTESTATION_CERTIFICATE, 0);
    RegisterRequest request = new RegisterRequest(SERVER_CHALLENGE_REGISTER_BASE64, APP_ID_ENROLL);
    RegisterResponse tokenResponse = new RegisterResponse(
        REGISTRATION_DATA_BASE64,
        CLIENT_DATA_REGISTRATION_BASE64
    );
    RegisterRequestData registerRequest = new RegisterRequestData(
        APP_ID_ENROLL,
        ImmutableList.<RegisteredKey>of(),
        ImmutableList.of(request)
    );
    DeviceRegistration device = u2f.finishRegistration(registerRequest, tokenResponse, ImmutableSet.of(APP_ID_ENROLL));
    DeviceRegistration overloadDevice = u2f.finishRegistration(registerRequest, tokenResponse);
    assertEquals(KEY_HANDLE_BASE64, device.getKeyHandle());
    assertEquals(device, overloadDevice);
}