ResourceSetRegistrationEndpointTest.java revision a093731116a8c24d49b903df7602cf586e499b45
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
public class ResourceSetRegistrationEndpointTest {
private static final JsonValue RESOURCE_SET_DESCRIPTION_CONTENT = json(object(field("name", "NAME"),
private static final JsonValue RESOURCE_SET_DESCRIPTION_UPDATED_CONTENT = json(object(field("name", "NEW_NAME"),
private ResourceSetRegistrationEndpoint endpoint;
private ResourceSetStore store;
private ResourceSetDescriptionValidator validator;
@SuppressWarnings("unchecked")
given(providerSettingsFactory.get(Matchers.<OAuth2Request>anyObject())).willReturn(providerSettings);
endpoint = spy(new ResourceSetRegistrationEndpoint(providerSettingsFactory, validator, requestFactory,
tokenStore));
given(tokenStore.readAccessToken(Matchers.<OAuth2Request>anyObject(), eq("PAT"))).willReturn(accessToken);
}
private void setUriResourceSetId() {
}
private void noUriResourceSetId() {
}
private void addCondition() {
}
private void noConditions() {
}
String jsonString = new ObjectMapper().writeValueAsString(RESOURCE_SET_DESCRIPTION_CONTENT.asMap());
return entity;
}
String jsonString = new ObjectMapper().writeValueAsString(RESOURCE_SET_DESCRIPTION_UPDATED_CONTENT.asMap());
return entity;
}
@Test
@SuppressWarnings("unchecked")
public void shouldCreateResourceSetDescription() throws Exception {
//Given
ResourceSetDescription resourceSetDescription = (ResourceSetDescription) invocation.getArguments()[1];
return null;
}
noConditions();
//When
//Then
}
@Test
@SuppressWarnings("unchecked")
public void shouldReadResourceSetDescription() throws Exception {
//Given
ResourceSetDescription resourceSetDescription = new ResourceSetDescription("ID", "RESOURCE_SET_ID", "CLIENT_ID",
//When
//Then
assertThat(responseBody).contains(entry("name", "NAME"), entry("uri", "URI"), entry("type", "TYPE"),
}
@Test
public void shouldUpdateResourceSetDescription() throws Exception {
//Given
ResourceSetDescription resourceSetDescription = new ResourceSetDescription("ID", "RESOURCE_SET_ID", "CLIENT_ID",
addCondition();
//When
//Then
}
@Test
public void shouldDeleteResourceSetDescription() throws Exception {
//Given
addCondition();
//When
//Then
}
@Test
@SuppressWarnings("unchecked")
public void shouldListResourceSetDescriptions() throws Exception {
//Given
ResourceSetDescription resourceSetDescription = new ResourceSetDescription("ID", "RESOURCE_SET_ID", "CLIENT_ID",
ResourceSetDescription resourceSetDescription2 = new ResourceSetDescription("ID_2", "RESOURCE_SET_ID_2",
"CLIENT_ID",
noConditions();
//When
//Then
}
}