void () { final Pair<ConsentOptions, MemoryIOBackend> data = createConsentOptions(JSON_CONSENTS_DATA, JSON_CONSENTS_DATA); final ConsentOptions options = data.getFirst(); final MemoryIOBackend storage = data.getSecond(); final Pair<List<Consent>, Boolean> beforeConfirm = options.getConsents(); assertTrue("Consents should require confirmation", beforeConfirm.getSecond()); assertEquals(2, beforeConfirm.getFirst().size()); assertEquals(JSON_CONSENTS_DATA, storage.myBundled); assertEquals(JSON_CONSENTS_DATA, storage.myDefaults); assertEquals("", storage.myConfirmed); final List<Consent> changedByUser = new ArrayList<>(); for (Consent consent : beforeConfirm.getFirst()) { changedByUser.add(consent.derive(!consent.isAccepted())); } options.setConsents(changedByUser); final Pair<List<Consent>, Boolean> afterConfirm = options.getConsents(); assertFalse("Consents should NOT require confirmation", afterConfirm.getSecond()); assertEquals(2, afterConfirm.getFirst().size()); assertEquals(JSON_CONSENTS_DATA, storage.myBundled); assertEquals(JSON_CONSENTS_DATA, storage.myDefaults); assertFalse("The storage should contain non-empty confirmed consents", StringUtil.isEmpty(storage.myConfirmed)); for (Consent userConsent : changedByUser) { final Consent loaded = lookupConsent(userConsent, afterConfirm.getFirst()); assertEquals(userConsent, loaded); assertEquals(userConsent.isAccepted(), loaded.isAccepted()); } }