@Test public void shouldReadResourceSetToken() throws Exception { // Given ResourceSetDescription resourceSetDescription = new ResourceSetDescription( "RESOURCE_SET_ID", "CLIENT_ID", "RESOURCE_OWNER_ID", Collections.<String, Object>emptyMap()); given( dataStore.query( QueryFilter.and( QueryFilter.equalTo(ResourceSetTokenField.RESOURCE_SET_ID, "RESOURCE_SET_ID"), QueryFilter.equalTo(ResourceSetTokenField.REALM, "REALM")))) .willReturn(Collections.singleton(resourceSetDescription)); // When ResourceSetDescription readResourceSetDescription = store.read("RESOURCE_SET_ID", "RESOURCE_OWNER_ID"); // Then assertThat(readResourceSetDescription).isEqualTo(readResourceSetDescription); }
@Test(expectedExceptions = NotFoundException.class) public void readWithResourceSetUidShouldThrowNotFoundExceptionWhenMultipleResourceSetsFound() throws Exception { // Given given(dataStore.read("123")) .willThrow(new org.forgerock.openam.sm.datalayer.store.NotFoundException("not found")); // When store.read("123", "RESOURCE_OWNER_ID"); // Then // Excepted NotFoundException }