From 11b13f497cc0784ae14fa8b0f056b4098920276a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 25 Apr 2013 10:27:56 +0000
Subject: [PATCH] Use factory methods from JsonValue.
---
opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java | 53 ++++-------------------------------------------------
1 files changed, 4 insertions(+), 49 deletions(-)
diff --git a/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java b/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java
index 7dcc575..c25c738 100644
--- a/opendj3/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/TestUtils.java
+++ b/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.
}
--
Gitblit v1.10.0