Browse files

Cleaned up toString logging of ApiObjects

  • Loading branch information...
1 parent dbd7cc6 commit 51940281a4dfee4acba1f94f6416332069a48af6 Matthew Wall committed May 24, 2010
View
1 .gitignore
@@ -3,4 +3,5 @@
*iws
*iml
projectFilesBackup/
+target/
View
1 client/.gitignore
@@ -1,2 +1,3 @@
client.iml
+target/*
target/
View
8 client/src/main/java/com/gu/openplatform/contentapi/ApiObject.java
@@ -28,6 +28,14 @@ public String getId() {
return id;
}
+ @Override public String toString() {
+ StringBuilder builder = new StringBuilder(getClass().getSimpleName());
+ builder.append(" [");
+ builder.append(id);
+ builder.append("]");
+ return builder.toString();
+ }
+
@Override public int hashCode() {
return getId().hashCode();
}
View
4 client/src/main/java/com/gu/openplatform/contentapi/SearchJsonParser.java
@@ -16,15 +16,15 @@
package com.gu.openplatform.contentapi;
-import net.sf.json.JSONArray;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import java.util.Iterator;
public class SearchJsonParser extends PaginatedJsonParser {
- @SuppressWarnings("unchecked") ContentSearchResponse parseJson(String json) {
+ @SuppressWarnings("unchecked")
+ ContentSearchResponse parseJson(String json) {
ContentSearchResponse contentSearchResponse = new ContentSearchResponse();
try {
View
9 client/src/main/java/com/gu/openplatform/contentapi/TagSearchClient.java
@@ -16,7 +16,11 @@
package com.gu.openplatform.contentapi;
-import java.util.*;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
public class TagSearchClient extends PaginatedSearchClient<TagSearchClient> {
@@ -62,13 +66,10 @@ public TagSearchClient showAllTagTypes() {
@Override
protected void fillInApiParameters(Map<ApiParameter, Object> parameters) {
super.fillInApiParameters(parameters);
-
addHttpParameter(parameters, ApiParameter.type, getTagTypesToFind());
}
Set<TagType> getTagTypesToFind() {
return Collections.unmodifiableSet(tagTypesToQuery);
}
-
-
}
View
9 client/src/test/java/com/gu/apitest/OutOfPackageContentSearchTest.java
@@ -16,7 +16,12 @@
package com.gu.apitest;
-import com.gu.openplatform.contentapi.*;
+import com.gu.openplatform.contentapi.Content;
+import com.gu.openplatform.contentapi.ContentSearchResponse;
+import com.gu.openplatform.contentapi.ContentTagType;
+import com.gu.openplatform.contentapi.GuardianContentApi;
+import com.gu.openplatform.contentapi.Tag;
+import com.gu.openplatform.contentapi.TagType;
import org.junit.After;
import org.junit.Test;
@@ -46,8 +51,6 @@ public void testCanSearchForContent() throws Exception {
for (Content content : results.getContent()) {
assertTrue(content.getTags().size() > 0);
- content.getTagsOfType(TagType.keyword);
-
for (Tag typeTag : content.getTagsOfType(TagType.contentType))
assertTrue(content.isOfType(ContentTagType.typeForId(typeTag.getId())));

0 comments on commit 5194028

Please sign in to comment.