mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
25.27.2013 11b13f497cc0784ae14fa8b0f056b4098920276a
Use factory methods from JsonValue.
2 files modified
57 ■■■■ changed files
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java 4 ●●●● patch | view | raw | blame | history
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java 53 ●●●●● patch | view | raw | blame | history
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/BasicRequestsTest.java
@@ -18,6 +18,8 @@
import static java.util.Arrays.asList;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
import static org.forgerock.json.fluent.JsonValue.field;
import static org.forgerock.json.fluent.JsonValue.object;
import static org.forgerock.json.resource.Requests.newDeleteRequest;
import static org.forgerock.json.resource.Requests.newReadRequest;
import static org.forgerock.json.resource.Requests.newUpdateRequest;
@@ -30,8 +32,6 @@
import static org.forgerock.opendj.rest2ldap.TestUtils.asResource;
import static org.forgerock.opendj.rest2ldap.TestUtils.content;
import static org.forgerock.opendj.rest2ldap.TestUtils.ctx;
import static org.forgerock.opendj.rest2ldap.TestUtils.field;
import static org.forgerock.opendj.rest2ldap.TestUtils.object;
import java.io.IOException;
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java
@@ -15,12 +15,10 @@
 */
package org.forgerock.opendj.rest2ldap;
import java.util.AbstractMap;
import static org.forgerock.json.fluent.JsonValue.json;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.forgerock.json.fluent.JsonPointer;
import org.forgerock.json.fluent.JsonValue;
@@ -34,17 +32,6 @@
public final class TestUtils {
    /**
     * Creates a JSON array object.
     *
     * @param objects
     *            The array elements.
     * @return A JSON array.
     */
    public static Object array(final Object... objects) {
        return Arrays.asList(objects);
    }
    /**
     * Returns a {@code Resource} containing the provided JSON content. The ID
     * and revision will be taken from the "_id" and "_rev" fields respectively.
     *
@@ -64,7 +51,7 @@
     * @return The JSON value.
     */
    public static JsonValue content(final Object object) {
        return new JsonValue(object);
        return json(object);
    }
    /**
@@ -86,21 +73,7 @@
     * @return The JSON value.
     */
    public static JsonValue expected(final Object object) {
        return content(object);
    }
    /**
     * Creates a JSON field for inclusion in a JSON object using
     * {@link #object(java.util.Map.Entry...)}.
     *
     * @param key
     *            The JSON field name.
     * @param value
     *            The JSON field value.
     * @return The JSON field for inclusion in a JSON object.
     */
    public static Map.Entry<String, Object> field(final String key, final Object value) {
        return new AbstractMap.SimpleImmutableEntry<String, Object>(key, value);
        return json(object);
    }
    /**
@@ -118,24 +91,6 @@
        return result;
    }
    /**
     * Creates a JSON object comprised of the provided JSON
     * {@link #field(String, Object) fields}.
     *
     * @param fields
     *            The list of {@link #field(String, Object) fields} to include
     *            in the JSON object.
     * @return The JSON object.
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static Object object(final Map.Entry... fields) {
        final Map<String, Object> object = new LinkedHashMap<String, Object>(fields.length);
        for (final Map.Entry<String, Object> field : fields) {
            object.put(field.getKey(), field.getValue());
        }
        return object;
    }
    private TestUtils() {
        // Prevent instantiation.
    }