@Test public void testListAllProfiles() throws Exception { givenRegisteredAccount("name1"); givenRegisteredAccount("name2"); List<Profile> profiles = cacheUnderTest.getAll(); assertThat(profiles, hasItems(Profile.create("name1"), Profile.create("name2"))); }
@Test public void testPut() throws Exception { AccountManager accountManager = AccountManager.get(RuntimeEnvironment.application); assertThat( "Failed precondition. There should be no accounts", accountManager.getAccountsByType(FakeAccount.TYPE).length == 0); cacheUnderTest.put(fakeProfile); Account account = new Account("name", JasperSettings.JASPER_ACCOUNT_TYPE); String alias = accountManager.getUserData(account, "ALIAS_KEY"); assertThat("Failed to put profile alias in cache", alias != null); }
@Test public void testHasProfile() throws Exception { givenRegisteredAccount("name"); assertThat( "Cache should contain profile with key: 'name'", cacheUnderTest.hasProfile(fakeProfile)); }