streams-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblack...@apache.org
Subject [01/42] incubator-streams git commit: STREAMS-440: custom checkstyle.xml, address compliance
Date Fri, 25 Nov 2016 20:24:42 GMT
Repository: incubator-streams
Updated Branches:
  refs/heads/master a726a67ed -> 5dffd5c32


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationGenericOrdering.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationGenericOrdering.java b/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationGenericOrdering.java
index a9a5ced..9bff713 100644
--- a/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationGenericOrdering.java
+++ b/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationGenericOrdering.java
@@ -27,48 +27,67 @@ import com.google.common.collect.Ordering;
  */
 public class ObjectCombinationGenericOrdering extends Ordering<ObjectCombination> {
 
-    public ObjectCombinationGenericOrdering() {}
+  public ObjectCombinationGenericOrdering() {}
 
-    @Override
-    public int compare(ObjectCombination left, ObjectCombination right) {
-        if( wildcardCount(left) < wildcardCount(right))
-            return -1;
-        if( wildcardCount(left) > wildcardCount(right))
-            return 1;
-        if( !wildcard(left.getActor()) && wildcard(right.getActor()))
-            return -1;
-        if( wildcard(left.getActor()) && !wildcard(right.getActor()))
-            return 1;
-        if( !wildcard(left.getObject()) && wildcard(right.getObject()))
-            return -1;
-        if( wildcard(left.getObject()) && !wildcard(right.getObject()))
-            return 1;
-        if( !wildcard(left.getTarget()) && wildcard(right.getTarget()))
-            return -1;
-        if( wildcard(left.getTarget()) && !wildcard(right.getTarget()))
-            return 1;
-        if( !wildcard(left.getProvider()) && wildcard(right.getProvider()))
-            return -1;
-        if( wildcard(left.getProvider()) && !wildcard(right.getProvider()))
-            return 1;
-        return 0;
+  @Override
+  public int compare(ObjectCombination left, ObjectCombination right) {
+    if ( wildcardCount(left) < wildcardCount(right)) {
+      return -1;
+    } else if ( wildcardCount(left) > wildcardCount(right)) {
+      return 1;
+    } else if ( !wildcard(left.getActor()) && wildcard(right.getActor())) {
+      return -1;
+    } else if ( wildcard(left.getActor()) && !wildcard(right.getActor())) {
+      return 1;
+    } else if ( !wildcard(left.getObject()) && wildcard(right.getObject())) {
+      return -1;
+    } else if ( wildcard(left.getObject()) && !wildcard(right.getObject())) {
+      return 1;
+    } else if ( !wildcard(left.getTarget()) && wildcard(right.getTarget())) {
+      return -1;
+    } else if ( wildcard(left.getTarget()) && !wildcard(right.getTarget())) {
+      return 1;
+    } else if ( !wildcard(left.getProvider()) && wildcard(right.getProvider())) {
+      return -1;
+    } else if ( wildcard(left.getProvider()) && !wildcard(right.getProvider())) {
+      return 1;
+    } else {
+      return 0;
     }
+  }
 
-    public int wildcardCount(ObjectCombination objectCombination) {
-        int wildcardCount = 0;
-        if( wildcard(objectCombination.getActor()))
-            wildcardCount++;
-        if( wildcard(objectCombination.getObject()))
-            wildcardCount++;
-        if( wildcard(objectCombination.getTarget()))
-            wildcardCount++;
-        if( wildcard(objectCombination.getProvider()))
-            wildcardCount++;
-        return wildcardCount;
+  /**
+   * count wildcards in this ObjectCombination.
+   * @param objectCombination ObjectCombination
+   * @return count
+   */
+  public int wildcardCount(ObjectCombination objectCombination) {
+    int wildcardCount = 0;
+    if ( wildcard(objectCombination.getActor())) {
+      wildcardCount++;
     }
+    if ( wildcard(objectCombination.getObject())) {
+      wildcardCount++;
+    }
+    if ( wildcard(objectCombination.getTarget())) {
+      wildcardCount++;
+    }
+    if ( wildcard(objectCombination.getProvider())) {
+      wildcardCount++;
+    }
+    return wildcardCount;
+  }
 
-    public boolean wildcard(String pattern) {
-        if( pattern.equals("*")) return true;
-        else return false;
+  /**
+   * is pattern a wildcard.
+   * @param pattern String
+   * @return true or false
+   */
+  public boolean wildcard(String pattern) {
+    if ( pattern.equals("*")) {
+      return true;
+    } else {
+      return false;
     }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationSpecificOrdering.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationSpecificOrdering.java b/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationSpecificOrdering.java
index 90f9f56..18b6d8b 100644
--- a/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationSpecificOrdering.java
+++ b/streams-verbs/src/main/java/org/apache/streams/verbs/ObjectCombinationSpecificOrdering.java
@@ -19,64 +19,85 @@
 
 package org.apache.streams.verbs;
 
-import com.google.common.collect.Ordering;
 import org.apache.streams.pojo.json.Activity;
 import org.apache.streams.pojo.json.ActivityObject;
 
+import com.google.common.collect.Ordering;
+
 /**
  * Orders ObjectCombinations from most specific to most general, in context of
  * degree of match to a specified Activity.
  */
 public class ObjectCombinationSpecificOrdering extends Ordering<ObjectCombination> {
 
-    private Activity activity;
+  private Activity activity;
 
-    public ObjectCombinationSpecificOrdering(Activity activity) {
-        this.activity = activity;
-    }
+  public ObjectCombinationSpecificOrdering(Activity activity) {
+    this.activity = activity;
+  }
 
-    @Override
-    public int compare(ObjectCombination left, ObjectCombination right) {
-        if( matchCount(left) < matchCount(right))
-            return 1;
-        if( matchCount(left) > matchCount(right))
-            return -1;
-        if( !match(activity.getActor(), left.getActor()) && match(activity.getActor(), right.getActor()))
-            return 1;
-        if( match(activity.getActor(), left.getActor()) && !match(activity.getActor(), right.getActor()))
-            return -1;
-        if( !match(activity.getObject(), left.getObject()) && match(activity.getObject(), right.getObject()))
-            return 1;
-        if( match(activity.getObject(), left.getObject()) && !match(activity.getObject(), right.getObject()))
-            return -1;
-        if( !match(activity.getTarget(), left.getTarget()) && match(activity.getTarget(), right.getTarget()))
-            return 1;
-        if( match(activity.getTarget(), left.getTarget()) && !match(activity.getTarget(), right.getTarget()))
-            return -1;
-        if( !match(activity.getProvider(), left.getProvider()) && match(activity.getTarget(), right.getProvider()))
-            return 1;
-        if( match(activity.getProvider(), left.getProvider()) && !match(activity.getTarget(), right.getProvider()))
-            return -1;
-        return 0;
+  @Override
+  public int compare(ObjectCombination left, ObjectCombination right) {
+    if (matchCount(left) < matchCount(right)) {
+      return 1;
+    } else if ( matchCount(left) > matchCount(right)) {
+      return -1;
+    } else if ( !match(activity.getActor(), left.getActor()) && match(activity.getActor(), right.getActor())) {
+      return 1;
+    } else if ( match(activity.getActor(), left.getActor()) && !match(activity.getActor(), right.getActor())) {
+      return -1;
+    } else if ( !match(activity.getObject(), left.getObject()) && match(activity.getObject(), right.getObject())) {
+      return 1;
+    } else if ( match(activity.getObject(), left.getObject()) && !match(activity.getObject(), right.getObject())) {
+      return -1;
+    } else if ( !match(activity.getTarget(), left.getTarget()) && match(activity.getTarget(), right.getTarget())) {
+      return 1;
+    } else if ( match(activity.getTarget(), left.getTarget()) && !match(activity.getTarget(), right.getTarget())) {
+      return -1;
+    } else if ( !match(activity.getProvider(), left.getProvider()) && match(activity.getTarget(), right.getProvider())) {
+      return 1;
+    } else if ( match(activity.getProvider(), left.getProvider()) && !match(activity.getTarget(), right.getProvider())) {
+      return -1;
+    } else {
+      return 0;
     }
+  }
 
-    public int matchCount(ObjectCombination objectCombination) {
-        int matchCount = 0;
-        if( match(activity.getActor(), objectCombination.getActor()))
-            matchCount++;
-        if( match(activity.getObject(), objectCombination.getObject()))
-            matchCount++;
-        if( match(activity.getTarget(), objectCombination.getTarget()))
-            matchCount++;
-        if( match(activity.getProvider(), objectCombination.getProvider()))
-            matchCount++;
-        return matchCount;
+  /**
+   * count matches between this ObjectCombination and this Activity.
+   * @param objectCombination ObjectCombination
+   * @return count
+   */
+  public int matchCount(ObjectCombination objectCombination) {
+    int matchCount = 0;
+    if ( match(activity.getActor(), objectCombination.getActor())) {
+      matchCount++;
+    }
+    if ( match(activity.getObject(), objectCombination.getObject())) {
+      matchCount++;
+    }
+    if ( match(activity.getTarget(), objectCombination.getTarget())) {
+      matchCount++;
+    }
+    if ( match(activity.getProvider(), objectCombination.getProvider())) {
+      matchCount++;
     }
+    return matchCount;
+  }
 
-    public boolean match(ActivityObject activityObject, String pattern) {
-        if( activityObject != null &&
-            activityObject.getObjectType() != null &&
-            activityObject.getObjectType().equals(pattern)) return true;
-        else return false;
+  /**
+   * whether this ActivityObject matches the corresponding ObjectCombination pattern.
+   * @param activityObject ActivityObject
+   * @param pattern pattern
+   * @return true or false
+   */
+  public boolean match(ActivityObject activityObject, String pattern) {
+    if ( activityObject != null
+         && activityObject.getObjectType() != null
+         && activityObject.getObjectType().equals(pattern)) {
+      return true;
+    } else {
+      return false;
     }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionMatchUtil.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionMatchUtil.java b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionMatchUtil.java
index bc177b2..b447794 100644
--- a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionMatchUtil.java
+++ b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionMatchUtil.java
@@ -24,30 +24,44 @@ import org.apache.streams.pojo.json.Activity;
 import java.util.Set;
 
 /**
- * Check whether an activity matches one or several VerbDefinition
+ * Check whether an activity matches one or several VerbDefinition.
  */
 public class VerbDefinitionMatchUtil {
 
-    public static boolean match(Activity activity, Set<VerbDefinition> verbDefinitionSet) {
-
-        for( VerbDefinition verbDefinition : verbDefinitionSet) {
-            if( match( activity, verbDefinition )) {
-                return true;
-            }
-        }
-        return false;
+  /**
+   * whether this Activity matches any of a Set of VerbDefinitions.
+   * @param activity Activity
+   * @param verbDefinitionSet Set of VerbDefinition
+   * @return true or false
+   */
+  public static boolean match(Activity activity, Set<VerbDefinition> verbDefinitionSet) {
 
+    for ( VerbDefinition verbDefinition : verbDefinitionSet) {
+      if ( match( activity, verbDefinition )) {
+        return true;
+      }
     }
+    return false;
+
+  }
 
-    public static boolean match(Activity activity, VerbDefinition verbDefinition) {
+  /**
+   * whether this Activity matches this VerbDefinition.
+   * @param activity Activity
+   * @param verbDefinition VerbDefinition
+   * @return true or false
+   */
+  public static boolean match(Activity activity, VerbDefinition verbDefinition) {
 
-        if( verbDefinition.getValue() != null &&
-            verbDefinition.getValue().equals(activity.getVerb())) {
-            for (ObjectCombination objectCombination : verbDefinition.getObjects())
-                if (VerbDefinitionResolver.filter(activity, objectCombination) == true)
-                    return true;
+    if ( verbDefinition.getValue() != null
+          && verbDefinition.getValue().equals(activity.getVerb())) {
+      for (ObjectCombination objectCombination : verbDefinition.getObjects()) {
+        if (VerbDefinitionResolver.filter(activity, objectCombination) == true) {
+          return true;
         }
-        return false;
+      }
     }
+    return false;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionResolver.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionResolver.java b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionResolver.java
index 595fb2e..81f0bfa 100644
--- a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionResolver.java
+++ b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionResolver.java
@@ -18,98 +18,122 @@
 
 package org.apache.streams.verbs;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.commons.lang.SerializationUtils;
 import org.apache.streams.pojo.json.Activity;
 import org.apache.streams.pojo.json.ActivityObject;
 import org.apache.streams.util.SerializationUtil;
+
+import com.google.common.collect.Lists;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.*;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class VerbDefinitionResolver {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(VerbDefinitionResolver.class);
-
-    protected Set<VerbDefinition> verbDefinitionSet;
-
-    public VerbDefinitionResolver() {
-        // get with reflection
-    }
-
-    public VerbDefinitionResolver(Set<VerbDefinition> verbDefinitionSet) {
-        this();
-        this.verbDefinitionSet = verbDefinitionSet;
-    }
-
-    public List<VerbDefinition> matchingVerbDefinitions(Activity activity) {
-
-        // ConcurrentHashSet is preferable, but it's only in guava 15+
-        // spark 1.5.0 uses guava 14 so for the moment this is the workaround
-        // Set<VerbDefinition> matches = Sets.newConcurrentHashSet();
-        Set<VerbDefinition> matches = Collections.newSetFromMap(new ConcurrentHashMap<VerbDefinition, Boolean>());
-
-        for( VerbDefinition verbDefinition : verbDefinitionSet ) {
-            VerbDefinition verbDefinitionCopy = SerializationUtil.cloneBySerialization(verbDefinition);
-            if( activity.getVerb().equals(verbDefinition.getValue())) {
-                for( ObjectCombination criteria : verbDefinitionCopy.getObjects()) {
-                    if( filter(activity, criteria) == false ) {
-                        verbDefinitionCopy.getObjects().remove(criteria);
-                    }
-                }
-                if( verbDefinitionCopy.getObjects().size() > 0)
-                    matches.add(verbDefinitionCopy);
-            }
+  private static final Logger LOGGER = LoggerFactory.getLogger(VerbDefinitionResolver.class);
+
+  protected Set<VerbDefinition> verbDefinitionSet;
+
+  public VerbDefinitionResolver() {
+    // get with reflection
+  }
+
+  public VerbDefinitionResolver(Set<VerbDefinition> verbDefinitionSet) {
+    this();
+    this.verbDefinitionSet = verbDefinitionSet;
+  }
+
+  /**
+   * return all matching VerbDefinitions for an Activity.
+   * @param activity Activity
+   * @return List of VerbDefinition
+   */
+  public List<VerbDefinition> matchingVerbDefinitions(Activity activity) {
+
+    // ConcurrentHashSet is preferable, but it's only in guava 15+
+    // spark 1.5.0 uses guava 14 so for the moment this is the workaround
+    // Set<VerbDefinition> matches = Sets.newConcurrentHashSet();
+    Set<VerbDefinition> matches = Collections.newSetFromMap(new ConcurrentHashMap<VerbDefinition, Boolean>());
+
+    for ( VerbDefinition verbDefinition : verbDefinitionSet ) {
+      VerbDefinition verbDefinitionCopy = SerializationUtil.cloneBySerialization(verbDefinition);
+      if ( activity.getVerb().equals(verbDefinition.getValue())) {
+        for ( ObjectCombination criteria : verbDefinitionCopy.getObjects()) {
+          if ( filter(activity, criteria) == false ) {
+            verbDefinitionCopy.getObjects().remove(criteria);
+          }
         }
-
-        return Lists.newArrayList(matches);
-
-    }
-
-    public List<ObjectCombination> matchingObjectCombinations(Activity activity) {
-
-        List<ObjectCombination> results = Lists.newArrayList();
-
-        for( VerbDefinition verbDefinition : verbDefinitionSet ) {
-            if( activity.getVerb().equals(verbDefinition.getValue())) {
-                for( ObjectCombination criteria : verbDefinition.getObjects()) {
-                    if( filter(activity, criteria) == true ) {
-                        results.add(criteria);
-                    }
-                }
-            }
+        if ( verbDefinitionCopy.getObjects().size() > 0) {
+          matches.add(verbDefinitionCopy);
         }
+      }
+    }
 
-        Collections.sort(results, new ObjectCombinationSpecificOrdering(activity));
+    return Lists.newArrayList(matches);
 
-        return results;
-    }
+  }
 
-    public static boolean filter(Activity activity, ObjectCombination criteria) {
+  /**
+   * return all matching ObjectCombinations for an Activity.
+   * @param activity Activity
+   * @return List of ObjectCombination
+   */
+  public List<ObjectCombination> matchingObjectCombinations(Activity activity) {
 
-        return  filterType(activity.getActor(), criteria.getActorRequired(), criteria.getActor())
-                &&
-                filterType(activity.getObject(), criteria.getObjectRequired(), criteria.getObject())
-                &&
-                filterType(activity.getProvider(), criteria.getProviderRequired(), criteria.getProvider())
-                &&
-                filterType(activity.getTarget(), criteria.getTargetRequired(), criteria.getTarget())
-                ;
+    List<ObjectCombination> results = Lists.newArrayList();
 
+    for ( VerbDefinition verbDefinition : verbDefinitionSet ) {
+      if ( activity.getVerb().equals(verbDefinition.getValue())) {
+        for ( ObjectCombination criteria : verbDefinition.getObjects()) {
+          if ( filter(activity, criteria) == true ) {
+            results.add(criteria);
+          }
+        }
+      }
     }
 
-    public static boolean filterType(ActivityObject activityObject, boolean required, String pattern) {
-        if (required == true && activityObject == null) return false;
-        if (required == false && activityObject == null) return true;
-        if (pattern.equals("*")) return true;
-        else if (activityObject.getObjectType() == null) return false;
-        else if (activityObject.getObjectType().equals(pattern))
-            return true;
-        else return false;
+    Collections.sort(results, new ObjectCombinationSpecificOrdering(activity));
+
+    return results;
+  }
+
+  /**
+   * whether this Activity matches this ObjectCombination.
+   * @param activity Activity
+   * @param criteria ObjectCombination
+   * @return true or false
+   */
+  public static boolean filter(Activity activity, ObjectCombination criteria) {
+
+    return  filterType(activity.getActor(), criteria.getActorRequired(), criteria.getActor())
+        &&
+        filterType(activity.getObject(), criteria.getObjectRequired(), criteria.getObject())
+        &&
+        filterType(activity.getProvider(), criteria.getProviderRequired(), criteria.getProvider())
+        &&
+        filterType(activity.getTarget(), criteria.getTargetRequired(), criteria.getTarget())
+        ;
+
+  }
+
+  public static boolean filterType(ActivityObject activityObject, boolean required, String pattern) {
+    if (required == true && activityObject == null) {
+      return false;
+    } else if (required == false && activityObject == null) {
+      return true;
+    } else if (pattern.equals("*")) {
+      return true;
+    } else if (activityObject.getObjectType() == null) {
+      return false;
+    } else if (activityObject.getObjectType().equals(pattern)) {
+      return true;
+    } else {
+      return false;
     }
+  }
 
 
 

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionTemplateUtil.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionTemplateUtil.java b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionTemplateUtil.java
index 3509b32..53113a7 100644
--- a/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionTemplateUtil.java
+++ b/streams-verbs/src/main/java/org/apache/streams/verbs/VerbDefinitionTemplateUtil.java
@@ -19,45 +19,66 @@
 
 package org.apache.streams.verbs;
 
-import com.google.common.base.Strings;
 import org.apache.streams.pojo.json.Activity;
 import org.apache.streams.pojo.json.ActivityObject;
+
+import com.google.common.base.Strings;
 import org.stringtemplate.v4.ST;
 
 /**
- * Transforms VerbDefinition templates into readable strings
+ * Transforms VerbDefinition templates into readable strings.
  */
 public class VerbDefinitionTemplateUtil {
 
-    public static String asString(Activity activity, ObjectCombination objectCombination) {
+  /**
+   * Transform Activity into readable string using ObjectCombination title.
+   * @param activity Activity
+   * @param objectCombination ObjectCombination
+   * @return String
+   */
+  public static String asString(Activity activity, ObjectCombination objectCombination) {
 
-        return asString("*", activity, objectCombination);
+    return asString("*", activity, objectCombination);
 
-    }
+  }
 
-    public static String asString(String language, Activity activity, ObjectCombination objectCombination) {
+  /**
+   * Transform Activity into readable string using ObjectCombination title and specified language.
+   * @param language language
+   * @param activity Activity
+   * @param objectCombination ObjectCombination
+   * @return String
+   */
+  public static String asString(String language, Activity activity, ObjectCombination objectCombination) {
 
-        String template = (String) objectCombination.getTemplates().getAdditionalProperties().get(language);
-        template = template.replace('{', '<');
-        template = template.replace('}', '>');
-        ST st = new ST(template);
-        st.add("actor", displayName(activity.getActor()));
-        st.add("provider", displayName(activity.getProvider()));
-        st.add("object", displayName(activity.getObject()));
-        st.add("target", displayName(activity.getTarget()));
+    String template = (String) objectCombination.getTemplates().getAdditionalProperties().get(language);
+    template = template.replace('{', '<');
+    template = template.replace('}', '>');
+    ST st = new ST(template);
+    st.add("actor", displayName(activity.getActor()));
+    st.add("provider", displayName(activity.getProvider()));
+    st.add("object", displayName(activity.getObject()));
+    st.add("target", displayName(activity.getTarget()));
 
-        return st.render();
-    }
+    return st.render();
+  }
 
-    public static String displayName(ActivityObject activityObject) {
-        if( activityObject == null )
-            return "";
-        if( !Strings.isNullOrEmpty(activityObject.getDisplayName()))
-            return activityObject.getDisplayName();
-        if( !Strings.isNullOrEmpty(activityObject.getObjectType()))
-            return activityObject.getObjectType();
-        if( !Strings.isNullOrEmpty(activityObject.toString()))
-            return activityObject.toString();
-        else return "";
+  /**
+   * Readable display Name for ActivityObject.
+   * @param activityObject ActivityObject
+   * @return displayName
+   */
+  public static String displayName(ActivityObject activityObject) {
+    if ( activityObject == null ) {
+      return "";
+    } else if ( !Strings.isNullOrEmpty(activityObject.getDisplayName())) {
+      return activityObject.getDisplayName();
+    } else if ( !Strings.isNullOrEmpty(activityObject.getObjectType())) {
+      return activityObject.getObjectType();
+    } else if ( !Strings.isNullOrEmpty(activityObject.toString())) {
+      return activityObject.toString();
+    } else {
+      return "";
     }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationGenericOrderingTest.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationGenericOrderingTest.java b/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationGenericOrderingTest.java
index 88f830b..16e6167 100644
--- a/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationGenericOrderingTest.java
+++ b/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationGenericOrderingTest.java
@@ -27,15 +27,15 @@ import org.junit.Test;
  */
 public class ObjectCombinationGenericOrderingTest  {
 
-    @Test
-    public void compareWildcardCountTest() {
-        ObjectCombination combination1 = new ObjectCombination();
-        ObjectCombination combination2 = new ObjectCombination().withActor("actor");
-        assert (new ObjectCombinationGenericOrdering()).compare(combination1, combination2) > 0;
-        ObjectCombination combination3 = new ObjectCombination();
-        ObjectCombination combination4 = new ObjectCombination().withProvider("provider");
-        assert (new ObjectCombinationGenericOrdering()).compare(combination3, combination4) > 0;
-    }
+  @Test
+  public void compareWildcardCountTest() {
+    ObjectCombination combination1 = new ObjectCombination();
+    ObjectCombination combination2 = new ObjectCombination().withActor("actor");
+    assert (new ObjectCombinationGenericOrdering()).compare(combination1, combination2) > 0;
+    ObjectCombination combination3 = new ObjectCombination();
+    ObjectCombination combination4 = new ObjectCombination().withProvider("provider");
+    assert (new ObjectCombinationGenericOrdering()).compare(combination3, combination4) > 0;
+  }
 
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationSpecificOrderingTest.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationSpecificOrderingTest.java b/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationSpecificOrderingTest.java
index 3162aa0..8162734 100644
--- a/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationSpecificOrderingTest.java
+++ b/streams-verbs/src/test/java/org/apache/streams/verbs/ObjectCombinationSpecificOrderingTest.java
@@ -22,6 +22,7 @@ package org.apache.streams.verbs;
 import org.apache.streams.pojo.json.Activity;
 import org.apache.streams.pojo.json.ActivityObject;
 import org.apache.streams.pojo.json.Provider;
+
 import org.junit.Test;
 
 /**
@@ -30,21 +31,21 @@ import org.junit.Test;
  */
 public class ObjectCombinationSpecificOrderingTest {
 
-    @Test
-    public void compareMatchCountTest() {
-        ActivityObject actor = new ActivityObject();
-        actor.setObjectType("actor");
-        Activity activity = new Activity().withActor(actor);
-        ObjectCombination combination1 = new ObjectCombination();
-        ObjectCombination combination2 = new ObjectCombination().withActor("actor");
-        assert (new ObjectCombinationSpecificOrdering(activity)).compare(combination1, combination2) > 0;
-        Provider provider = new Provider();
-        provider.setObjectType("application");
-        Activity activity2 = new Activity().withProvider(provider);
-        ObjectCombination combination3 = new ObjectCombination();
-        ObjectCombination combination4 = new ObjectCombination().withProvider("application");
-        assert (new ObjectCombinationSpecificOrdering(activity2)).compare(combination3, combination4) > 0;
-    }
+  @Test
+  public void compareMatchCountTest() {
+    ActivityObject actor = new ActivityObject();
+    actor.setObjectType("actor");
+    Activity activity = new Activity().withActor(actor);
+    ObjectCombination combination1 = new ObjectCombination();
+    ObjectCombination combination2 = new ObjectCombination().withActor("actor");
+    assert (new ObjectCombinationSpecificOrdering(activity)).compare(combination1, combination2) > 0;
+    Provider provider = new Provider();
+    provider.setObjectType("application");
+    Activity activity2 = new Activity().withProvider(provider);
+    ObjectCombination combination3 = new ObjectCombination();
+    ObjectCombination combination4 = new ObjectCombination().withProvider("application");
+    assert (new ObjectCombinationSpecificOrdering(activity2)).compare(combination3, combination4) > 0;
+  }
 
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionResolverTest.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionResolverTest.java b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionResolverTest.java
index e3445c5..b4d2b2e 100644
--- a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionResolverTest.java
+++ b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionResolverTest.java
@@ -19,91 +19,92 @@
 
 package org.apache.streams.verbs;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Sets;
 import org.apache.streams.jackson.StreamsJacksonMapper;
 import org.apache.streams.pojo.json.Activity;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Sets;
 import org.junit.Test;
 
 import java.util.List;
 
 /**
- * Tests for {$link: org.apache.streams.verbs.VerbDefinitionResolver}
+ * Tests for {$link: org.apache.streams.verbs.VerbDefinitionResolver}.
  */
 public class VerbDefinitionResolverTest {
 
-    ObjectMapper mapper = StreamsJacksonMapper.getInstance();
+  ObjectMapper mapper = StreamsJacksonMapper.getInstance();
 
-    /**
-     * Test of matchingVerbDefinitions
-     */
-    @Test
-    public void testMatchingVerbDefinitions() throws Exception {
-        VerbDefinition definition = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
-        VerbDefinitionResolver resolver = new VerbDefinitionResolver(Sets.newHashSet(definition));
-        Activity activity0 = mapper.readValue("{\"id\":\"1\",\"verb\":\"notpost\"}\n", Activity.class);
-        List<VerbDefinition> result0 = resolver.matchingVerbDefinitions(activity0);
-        assert result0.size() == 0;
-        Activity activity1 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\"}\n", Activity.class);
-        List<VerbDefinition> result1 = resolver.matchingVerbDefinitions(activity1);
-        assert result1.size() == 1;
-        assert definition.equals(result1.get(0));
-        Activity activity2 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"product\"}}\n", Activity.class);
-        List<VerbDefinition> result2 = resolver.matchingVerbDefinitions(activity2);
-        assert result2.size() == 1;
-        assert definition.equals(result2.get(0));
-        Activity activity3 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"application\"}}\n\n", Activity.class);
-        List<VerbDefinition> result3 = resolver.matchingVerbDefinitions(activity3);
-        assert result3.size() == 1;
-        assert definition.equals(result3.get(0));
-        Activity activity4 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"object\":{\"id\":\"objectId\",\"objectType\":\"task\"}}\n", Activity.class);
-        List<VerbDefinition> result4 = resolver.matchingVerbDefinitions(activity4);
-        assert result4.size() == 1;
-        assert definition.equals(result4.get(0));
-        Activity activity5 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"target\":{\"id\":\"targetId\",\"objectType\":\"group\"}}\n", Activity.class);
-        List<VerbDefinition> result5 = resolver.matchingVerbDefinitions(activity5);
-        assert result5.size() == 1;
-        assert definition.equals(result5.get(0));
-        Activity activity6 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"actor\":{\"id\":\"actorId\",\"objectType\":\"page\"}}\n", Activity.class);
-        List<VerbDefinition> result6 = resolver.matchingVerbDefinitions(activity6);
-        assert result6.size() == 1;
-        assert definition.equals(result6.get(0));
-    }
+  /**
+   * Test of matchingVerbDefinitions.
+   */
+  @Test
+  public void testMatchingVerbDefinitions() throws Exception {
+    VerbDefinition definition = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
+    VerbDefinitionResolver resolver = new VerbDefinitionResolver(Sets.newHashSet(definition));
+    Activity activity0 = mapper.readValue("{\"id\":\"1\",\"verb\":\"notpost\"}\n", Activity.class);
+    List<VerbDefinition> result0 = resolver.matchingVerbDefinitions(activity0);
+    assert result0.size() == 0;
+    Activity activity1 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\"}\n", Activity.class);
+    List<VerbDefinition> result1 = resolver.matchingVerbDefinitions(activity1);
+    assert result1.size() == 1;
+    assert definition.equals(result1.get(0));
+    Activity activity2 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"product\"}}\n", Activity.class);
+    List<VerbDefinition> result2 = resolver.matchingVerbDefinitions(activity2);
+    assert result2.size() == 1;
+    assert definition.equals(result2.get(0));
+    Activity activity3 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"application\"}}\n\n", Activity.class);
+    List<VerbDefinition> result3 = resolver.matchingVerbDefinitions(activity3);
+    assert result3.size() == 1;
+    assert definition.equals(result3.get(0));
+    Activity activity4 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"object\":{\"id\":\"objectId\",\"objectType\":\"task\"}}\n", Activity.class);
+    List<VerbDefinition> result4 = resolver.matchingVerbDefinitions(activity4);
+    assert result4.size() == 1;
+    assert definition.equals(result4.get(0));
+    Activity activity5 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"target\":{\"id\":\"targetId\",\"objectType\":\"group\"}}\n", Activity.class);
+    List<VerbDefinition> result5 = resolver.matchingVerbDefinitions(activity5);
+    assert result5.size() == 1;
+    assert definition.equals(result5.get(0));
+    Activity activity6 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"actor\":{\"id\":\"actorId\",\"objectType\":\"page\"}}\n", Activity.class);
+    List<VerbDefinition> result6 = resolver.matchingVerbDefinitions(activity6);
+    assert result6.size() == 1;
+    assert definition.equals(result6.get(0));
+  }
 
-    /**
-     * Test of matchingObjectCombinations
-     */
-    @Test
-    public void testMatchingObjectCombinations() throws Exception {
-        VerbDefinition provider = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/provider.json"), VerbDefinition.class);
-        VerbDefinition actor = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/actor.json"), VerbDefinition.class);
-        VerbDefinition object = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/object.json"), VerbDefinition.class);
-        VerbDefinition post = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
-        VerbDefinition follow = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/follow.json"), VerbDefinition.class);
-        VerbDefinitionResolver resolver = new VerbDefinitionResolver(Sets.newHashSet(provider, actor, object, post, follow));
-        Activity activity0 = mapper.readValue("{\"id\":\"1\",\"verb\":\"notpost\"}\n", Activity.class);
-        List<ObjectCombination> result0 = resolver.matchingObjectCombinations(activity0);
-        assert result0.size() == 0;
-        Activity activity1 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\"}\n", Activity.class);
-        List<ObjectCombination> result1 = resolver.matchingObjectCombinations(activity1);
-        assert result1.size() == 4;
-        Activity activity2 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"product\"}}\n", Activity.class);
-        List<ObjectCombination> result2 = resolver.matchingObjectCombinations(activity2);
-        assert result2.size() == 3;
-        Activity activity3 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"application\"}}\n", Activity.class);
-        List<ObjectCombination> result3 = resolver.matchingObjectCombinations(activity3);
-        assert result3.size() == 4;
-        assert provider.getObjects().get(0).equals(result3.get(0));
-        Activity activity4 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"object\":{\"id\":\"objectId\",\"objectType\":\"task\"}}\n", Activity.class);
-        List<ObjectCombination> result4 = resolver.matchingObjectCombinations(activity4);
-        assert result4.size() == 4;
-        assert object.getObjects().get(0).equals(result4.get(0));
-        Activity activity5 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"target\":{\"id\":\"targetId\",\"objectType\":\"group\"}}\n", Activity.class);
-        List<ObjectCombination> result5 = resolver.matchingObjectCombinations(activity5);
-        assert result5.size() == 4;
-        Activity activity6 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"actor\":{\"id\":\"actorId\",\"objectType\":\"person\"}}\n", Activity.class);
-        List<ObjectCombination> result6 = resolver.matchingObjectCombinations(activity6);
-        assert result6.size() == 4;
-        assert actor.getObjects().get(0).equals(result6.get(0));
-    }
+  /**
+   * Test of matchingObjectCombinations.
+   */
+  @Test
+  public void testMatchingObjectCombinations() throws Exception {
+    VerbDefinition provider = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/provider.json"), VerbDefinition.class);
+    VerbDefinition actor = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/actor.json"), VerbDefinition.class);
+    VerbDefinition object = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/object.json"), VerbDefinition.class);
+    VerbDefinition post = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
+    VerbDefinition follow = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/follow.json"), VerbDefinition.class);
+    VerbDefinitionResolver resolver = new VerbDefinitionResolver(Sets.newHashSet(provider, actor, object, post, follow));
+    Activity activity0 = mapper.readValue("{\"id\":\"1\",\"verb\":\"notpost\"}\n", Activity.class);
+    List<ObjectCombination> result0 = resolver.matchingObjectCombinations(activity0);
+    assert result0.size() == 0;
+    Activity activity1 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\"}\n", Activity.class);
+    List<ObjectCombination> result1 = resolver.matchingObjectCombinations(activity1);
+    assert result1.size() == 4;
+    Activity activity2 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"product\"}}\n", Activity.class);
+    List<ObjectCombination> result2 = resolver.matchingObjectCombinations(activity2);
+    assert result2.size() == 3;
+    Activity activity3 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"provider\":{\"id\":\"providerId\",\"objectType\":\"application\"}}\n", Activity.class);
+    List<ObjectCombination> result3 = resolver.matchingObjectCombinations(activity3);
+    assert result3.size() == 4;
+    assert provider.getObjects().get(0).equals(result3.get(0));
+    Activity activity4 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"object\":{\"id\":\"objectId\",\"objectType\":\"task\"}}\n", Activity.class);
+    List<ObjectCombination> result4 = resolver.matchingObjectCombinations(activity4);
+    assert result4.size() == 4;
+    assert object.getObjects().get(0).equals(result4.get(0));
+    Activity activity5 = mapper.readValue("{\"id\":\"id\",\"verb\":\"post\",\"target\":{\"id\":\"targetId\",\"objectType\":\"group\"}}\n", Activity.class);
+    List<ObjectCombination> result5 = resolver.matchingObjectCombinations(activity5);
+    assert result5.size() == 4;
+    Activity activity6 = mapper.readValue("{\"id\":\"1\",\"verb\":\"post\",\"actor\":{\"id\":\"actorId\",\"objectType\":\"person\"}}\n", Activity.class);
+    List<ObjectCombination> result6 = resolver.matchingObjectCombinations(activity6);
+    assert result6.size() == 4;
+    assert actor.getObjects().get(0).equals(result6.get(0));
+  }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTemplateTest.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTemplateTest.java b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTemplateTest.java
index eeb61f7..ba91b06 100644
--- a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTemplateTest.java
+++ b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTemplateTest.java
@@ -19,67 +19,66 @@
 
 package org.apache.streams.verbs;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.streams.pojo.json.Activity;
 import org.apache.streams.pojo.json.ActivityObject;
 import org.apache.streams.pojo.json.Provider;
-import org.junit.Test;
 
-import java.lang.annotation.Target;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Test;
 
 /**
- * Tests for {$link: org.apache.streams.verbs.VerbDefinitionTemplateUtil}
+ * Tests for {$link: org.apache.streams.verbs.VerbDefinitionTemplateUtil}.
  */
 public class VerbDefinitionTemplateTest {
 
-    ObjectMapper mapper = new ObjectMapper();
+  ObjectMapper mapper = new ObjectMapper();
 
-    /**
-     * Test application of template with no field
-     */
-    @Test
-    public void testNoField() throws Exception {
-        Activity activity = new Activity().withVerb("nofields");
-        VerbDefinition definition = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/nofields.json"), VerbDefinition.class);
-        assert VerbDefinitionTemplateUtil.asString(activity, definition.getObjects().get(0)).contains("something");
-    }
+  /**
+   * Test application of template with no field.
+   */
+  @Test
+  public void testNoField() throws Exception {
+    Activity activity = new Activity().withVerb("nofields");
+    VerbDefinition definition = mapper.readValue(VerbDefinitionResolverTest.class.getResourceAsStream("/nofields.json"), VerbDefinition.class);
+    assert VerbDefinitionTemplateUtil.asString(activity, definition.getObjects().get(0)).contains("something");
+  }
 
-    /**
-     * Test application of template with top-level fields
-     */
-    @Test
-    public void testTopField() throws Exception {
-        ActivityObject actor = new ActivityObject();
-        actor.setObjectType("page");
-        actor.setDisplayName("Paige");
-        Provider provider = new Provider();
-        provider.setObjectType("application");
-        provider.setDisplayName("Ahp");
-        ActivityObject object = new ActivityObject();
-        object.setObjectType("task");
-        object.setDisplayName("Tsk");
-        ActivityObject target = new ActivityObject();
-        target.setObjectType("person");
-        target.setDisplayName("Homie");
-        Activity activity = new Activity().withVerb("post");
-        activity.setActor(actor);
-        activity.setProvider(provider);
-        activity.setObject(object);
-        activity.setTarget(target);
-        VerbDefinition definition = mapper.readValue(VerbDefinitionTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
-        String message = VerbDefinitionTemplateUtil.asString(activity, definition.getObjects().get(0));
-        assert message.contains("Paige");
-        assert message.contains("Ahp");
-        assert message.contains("Tsk");
-        assert message.contains("Homie");
-    }
+  /**
+   * Test application of template with top-level fields.
+   */
+  @Test
+  public void testTopField() throws Exception {
+    ActivityObject actor = new ActivityObject();
+    actor.setObjectType("page");
+    actor.setDisplayName("Paige");
+    Provider provider = new Provider();
+    provider.setObjectType("application");
+    provider.setDisplayName("Ahp");
+    ActivityObject object = new ActivityObject();
+    object.setObjectType("task");
+    object.setDisplayName("Tsk");
+    ActivityObject target = new ActivityObject();
+    target.setObjectType("person");
+    target.setDisplayName("Homie");
+    Activity activity = new Activity().withVerb("post");
+    activity.setActor(actor);
+    activity.setProvider(provider);
+    activity.setObject(object);
+    activity.setTarget(target);
+    VerbDefinition definition = mapper.readValue(VerbDefinitionTest.class.getResourceAsStream("/post.json"), VerbDefinition.class);
+    String message = VerbDefinitionTemplateUtil.asString(activity, definition.getObjects().get(0));
+    assert message.contains("Paige");
+    assert message.contains("Ahp");
+    assert message.contains("Tsk");
+    assert message.contains("Homie");
+  }
 
-    /**
-     * Test application of template with second-level fields
-     */
-    @Test
-    public void testSecondFields() {
+  /**
+   * Test application of template with second-level fields.
+   */
+  @Test
+  public void testSecondFields() {
 
-    }
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/5dffd5c3/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTest.java
----------------------------------------------------------------------
diff --git a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTest.java b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTest.java
index 6be59b1..c481f5c 100644
--- a/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTest.java
+++ b/streams-verbs/src/test/java/org/apache/streams/verbs/VerbDefinitionTest.java
@@ -22,42 +22,45 @@ package org.apache.streams.verbs;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.Test;
 
+/**
+ * Unit tests for VerbDefinition and utils.
+ */
 public class VerbDefinitionTest {
 
-    ObjectMapper mapper = new ObjectMapper();
-
-    /**
-     * Test read verb definition from json
-     */
-    @Test
-    public void testReadVerbDefinitionJson() throws Exception {
-
-        VerbDefinition definition = mapper.readValue(VerbDefinitionTest.class.getResourceAsStream("/do.json"), VerbDefinition.class);
-
-        assert definition != null;
-        assert definition.getObjectType().equals("verb");
-        assert definition.getObjects().size() == 1;
-        assert definition.getObjects().get(0).getActor().equals("*");
-        assert definition.getObjects().get(0).getObject().equals("*");
-        assert definition.getObjects().get(0).getTarget().equals("*");
-        assert definition.getObjects().get(0).getProvider().equals("*");
-        assert definition.getObjects().get(0).getTemplates().getAdditionalProperties().size() == 1;
-    }
-
-    /**
-     * Test verb definition defaults are set
-     */
-    @Test
-    public void testObjectCombinationDefaults() throws Exception {
-
-        ObjectCombination combination = new ObjectCombination();
-
-        assert combination.getActor().equals("*");
-        assert combination.getObject().equals("*");
-        assert combination.getTarget().equals("*");
-        assert combination.getProvider().equals("*");
-        assert combination.getTargetRequired() == false;
-
-    }
+  ObjectMapper mapper = new ObjectMapper();
+
+  /**
+   * Test read verb definition from json.
+   */
+  @Test
+  public void testReadVerbDefinitionJson() throws Exception {
+
+    VerbDefinition definition = mapper.readValue(VerbDefinitionTest.class.getResourceAsStream("/do.json"), VerbDefinition.class);
+
+    assert definition != null;
+    assert definition.getObjectType().equals("verb");
+    assert definition.getObjects().size() == 1;
+    assert definition.getObjects().get(0).getActor().equals("*");
+    assert definition.getObjects().get(0).getObject().equals("*");
+    assert definition.getObjects().get(0).getTarget().equals("*");
+    assert definition.getObjects().get(0).getProvider().equals("*");
+    assert definition.getObjects().get(0).getTemplates().getAdditionalProperties().size() == 1;
+  }
+
+  /**
+   * Test verb definition defaults are set.
+   */
+  @Test
+  public void testObjectCombinationDefaults() throws Exception {
+
+    ObjectCombination combination = new ObjectCombination();
+
+    assert combination.getActor().equals("*");
+    assert combination.getObject().equals("*");
+    assert combination.getTarget().equals("*");
+    assert combination.getProvider().equals("*");
+    assert combination.getTargetRequired() == false;
+
+  }
 
 }


Mime
View raw message