ONOS-4751-Fix:creating GroupType INDIRECT, multiple bucket(REST API)

Change-Id: Ic8d5a04b8b00ca43bfadbb3019aa5d72e799da6f
diff --git a/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java b/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
index 93473a5..9037dcc 100644
--- a/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
+++ b/core/common/src/test/java/org/onosproject/codec/impl/GroupCodecTest.java
@@ -33,7 +33,6 @@
 import org.onosproject.net.group.Group;
 import org.onosproject.net.group.GroupBucket;
 import org.onosproject.net.group.GroupBuckets;
-import org.onosproject.net.group.GroupDescription;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -47,6 +46,7 @@
 import static org.hamcrest.Matchers.equalTo;
 import static org.onosproject.codec.impl.GroupJsonMatcher.matchesGroup;
 import static org.onosproject.net.NetTestTools.APP_ID;
+import static org.onosproject.net.group.GroupDescription.Type.*;
 
 /**
  * Group codec unit tests.
@@ -81,19 +81,27 @@
         GroupBucket bucket2 = DefaultGroupBucket
                 .createIndirectGroupBucket(DefaultTrafficTreatment.emptyTreatment());
         GroupBuckets buckets = new GroupBuckets(ImmutableList.of(bucket1, bucket2));
-
+        GroupBuckets bucketsIndirect = new GroupBuckets(ImmutableList.of(bucket2));
 
         DefaultGroup group = new DefaultGroup(
                 new DefaultGroupId(1),
                 NetTestTools.did("d1"),
-                GroupDescription.Type.INDIRECT,
+                ALL,
                 buckets);
+        DefaultGroup group1 = new DefaultGroup(
+                new DefaultGroupId(2),
+                NetTestTools.did("d2"),
+                INDIRECT,
+                bucketsIndirect);
 
         MockCodecContext context = new MockCodecContext();
         GroupCodec codec = new GroupCodec();
         ObjectNode groupJson = codec.encode(group, context);
 
+        ObjectNode groupJsonIndirect = codec.encode(group1, context);
+
         assertThat(groupJson, matchesGroup(group));
+        assertThat(groupJsonIndirect, matchesGroup(group1));
     }
 
     @Test
@@ -108,6 +116,7 @@
         Instruction instruction1 = groupBucket.treatment().allInstructions().get(0);
         assertThat(instruction1.type(), is(Instruction.Type.OUTPUT));
         assertThat(((Instructions.OutputInstruction) instruction1).port(), is(PortNumber.portNumber(2)));
+
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -129,6 +138,7 @@
         assertThat(group.id().id(), is(1));
     }
 
+
     /**
      * Reads in a group from the given resource and decodes it.
      *