public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label,
                                                                 String username, String password) {
        DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username)
                .set(AnnotationKeys.PASSWORD, password).build();

        return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations);
    }
@Test
    public void testCreateDeviceKeyUsingUsernamePassword() {
        DeviceKeyId deviceKeyId = DeviceKeyId.deviceKeyId(deviceKeyIdValue);

        DeviceKey deviceKey = DeviceKey.createDeviceKeyUsingUsernamePassword(deviceKeyId, deviceKeyLabel,
                                                                             deviceKeyUsername, deviceKeyPassword);
        assertNotNull("The deviceKey should not be null.", deviceKey);
        assertEquals("The deviceKeyId should match as expected", deviceKeyId, deviceKey.deviceKeyId());
        assertEquals("The label should match as expected", deviceKeyLabel, deviceKey.label());
        assertEquals("The type should match as expected", DeviceKey.Type.USERNAME_PASSWORD, deviceKey.type());

        UsernamePassword usernamePassword = deviceKey.asUsernamePassword();
        assertNotNull("The usernamePassword should not be null.", usernamePassword);
        assertEquals("The username should match as expected", deviceKeyUsername, usernamePassword.username());
        assertEquals("The password should match as expected", deviceKeyPassword, usernamePassword.password());
    }