// Path: src-test/assertions/A.java
// public class A<T>
// {
//     private T expected;
// 
//     public A(T expected)
//     {
//         this.expected = expected;
//     }
// 
//     public void act(T actual)
//     {
//         compare(expected,actual,"");
//     }
// 
//     public void act(T actual,String message)
//     {
//         compare(expected,actual,message);
//     }
// 
//     private void compare(T exp,T act,String message)
//     {
//         if (exp instanceof Collection)
//         {
//             Collection expCollection = (Collection) exp;
//             Collection actCollection = (Collection) act;
//             compareCollection(expCollection,actCollection,message);
//         }
//         else
//         {
//             Assert.assertEquals(message,exp,act);
//         }
//     }
// 
//     private <U extends Collection> void compareCollection(U exp,U act,String message)
//     {
//         Assert.assertEquals(message + " -> Collection sizes does not match",exp.size(),act.size());
// 
//         for (Object e : exp)
//         {
//             boolean found = false;
//             for (Object a : act)
//             {
//                 if (e.equals(a))
//                 {
//                     found = true;
//                     break;
//                 }
//             }
//             if (!found)
//                 Assert.fail(String.format(message + " -> expected object %s does not exists in actual object list",e));
//         }
//     }
// 
//     public static <T> A<T> exp(T t)
//     {
//         return new A<>(t);
//     }
// }
// 
// Path: src/joquery/core/QueryException.java
// public class QueryException extends Exception
// {
//     public QueryException(String message)
//     {
//         super(message);
//     }
// 
//     public QueryException(String message, Throwable cause)
//     {
//         super(message, cause);
//     }
// }


import assertions.A;
import joquery.core.QueryException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
        A.exp(createCompareString(groupById())).act(createCompareString(groupedList));
    }

    @Test
    public void groupById_UsingPropertyWithValidList_ShouldGroupById() throws QueryException
    {
        GroupQuery<Integer,Dto> query = CQ.<Dto,Dto>query()
                .from(dtoList)
                .<Integer>group()
                .groupBy("id")
                .orderBy()
                .property("key");

        Collection<Grouping<Integer,Dto>> groupedList = query.list();
        A.exp(groupById().size()).act(groupedList.size());
        A.exp(createCompareString(groupById())).act(createCompareString(groupedList));
    }

    @Test
    public void groupByText_UsingFuncWithValidList_ShouldGroupByText() throws QueryException
    {
        GroupQuery<Integer,Dto> query = CQ.<Dto,Dto>query()
                .from(dtoList)
                .<Integer>group()
                .groupBy(Dto::getText)
                .orderBy()
                .property("key");

        Collection<Grouping<Integer,Dto>> groupedList = query.list();
        A.exp(groupByText().size()).act(groupedList.size());
// Path: src-test/assertions/A.java
// public class A<T>
// {
//     private T expected;
// 
//     public A(T expected)
//     {
//         this.expected = expected;
//     }
// 
//     public void act(T actual)
//     {
//         compare(expected,actual,"");
//     }
// 
//     public void act(T actual,String message)
//     {
//         compare(expected,actual,message);
//     }
// 
//     private void compare(T exp,T act,String message)
//     {
//         if (exp instanceof Collection)
//         {
//             Collection expCollection = (Collection) exp;
//             Collection actCollection = (Collection) act;
//             compareCollection(expCollection,actCollection,message);
//         }
//         else
//         {
//             Assert.assertEquals(message,exp,act);
//         }
//     }
// 
//     private <U extends Collection> void compareCollection(U exp,U act,String message)
//     {
//         Assert.assertEquals(message + " -> Collection sizes does not match",exp.size(),act.size());
// 
//         for (Object e : exp)
//         {
//             boolean found = false;
//             for (Object a : act)
//             {
//                 if (e.equals(a))
//                 {
//                     found = true;
//                     break;
//                 }
//             }
//             if (!found)
//                 Assert.fail(String.format(message + " -> expected object %s does not exists in actual object list",e));
//         }
//     }
// 
//     public static <T> A<T> exp(T t)
//     {
//         return new A<>(t);
//     }
// }
// 
// Path: src/joquery/core/QueryException.java
// public class QueryException extends Exception
// {
//     public QueryException(String message)
//     {
//         super(message);
//     }
// 
//     public QueryException(String message, Throwable cause)
//     {
//         super(message, cause);
//     }
// }


// Path: src-test/joquery/GroupTest.java
import assertions.A;
import joquery.core.QueryException;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

        A.exp(createCompareString(groupById())).act(createCompareString(groupedList));
    }

    @Test
    public void groupById_UsingPropertyWithValidList_ShouldGroupById() throws QueryException
    {
        GroupQuery<Integer,Dto> query = CQ.<Dto,Dto>query()
                .from(dtoList)
                .<Integer>group()
                .groupBy("id")
                .orderBy()
                .property("key");

        Collection<Grouping<Integer,Dto>> groupedList = query.list();
        A.exp(groupById().size()).act(groupedList.size());
        A.exp(createCompareString(groupById())).act(createCompareString(groupedList));
    }

    @Test
    public void groupByText_UsingFuncWithValidList_ShouldGroupByText() throws QueryException
    {
        GroupQuery<Integer,Dto> query = CQ.<Dto,Dto>query()
                .from(dtoList)
                .<Integer>group()
                .groupBy(Dto::getText)
                .orderBy()
                .property("key");

        Collection<Grouping<Integer,Dto>> groupedList = query.list();
        A.exp(groupByText().size()).act(groupedList.size());
        A.exp(createCompareString(groupByText())).act(createCompareString(groupedList));