RegisterRequestData extends JsonSerializable implements Persistable { public List<RegisteredKey> getRegisteredKeys() { return ImmutableList.copyOf(registeredKeys); } RegisterRequestData(@JsonProperty("appId") String appId, @JsonProperty("registeredKeys") List<RegisteredKey> registeredKeys, @JsonProperty("registerRequests") List<RegisterRequest> registerRequests);  RegisterRequestData(String appId, Iterable<? extends DeviceRegistration> devices, U2fPrimitives u2f, ChallengeGenerator challengeGenerator); List<RegisteredKey> getRegisteredKeys(); List<RegisterRequest> getRegisterRequests(); RegisterRequest getRegisterRequest(RegisterResponse response); String getRequestId(); static RegisterRequestData fromJson(String json);  }
@Test public void testConstructorAddsOneRegisteredKeyForEachGivenNonCompromisedDeviceRegistration() { DeviceRegistration good1 = mockDevice("A", false); DeviceRegistration good2 = mockDevice("B", false); DeviceRegistration bad1 = mockDevice("C", true); DeviceRegistration bad2 = mockDevice("D", true); RegisterRequestData result = new RegisterRequestData( "AppId", ImmutableList.of(good1, bad1, bad2, good2), new U2fPrimitives(), new RandomChallengeGenerator() ); assertEquals(2, result.getRegisteredKeys().size()); assertTrue(result.getRegisteredKeys().contains(new RegisteredKey(U2fPrimitives.U2F_VERSION, "A", null, null))); assertTrue(result.getRegisteredKeys().contains(new RegisteredKey(U2fPrimitives.U2F_VERSION, "B", null, null))); }