Example usage for org.apache.commons.collections4 ListUtils isEqualList

List of usage examples for org.apache.commons.collections4 ListUtils isEqualList

Introduction

In this page you can find the example usage for org.apache.commons.collections4 ListUtils isEqualList.

Prototype

public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) 

Source Link

Document

Tests two lists for value-equality as per the equality contract in java.util.List#equals(java.lang.Object) .

Usage

From source file:com.romeikat.datamessie.core.base.query.entity.EntityWithIdQueryTest.java

@Test
public void listForProjection() {
    final EntityWithIdQuery<BarEntityWithId> query = new EntityWithIdQuery<>(BarEntityWithId.class);
    query.addOrder(Order.asc("name"));

    @SuppressWarnings("unchecked")
    final List<String> names = (List<String>) query.listForProjection(sessionProvider.getStatelessSession(),
            Projections.property("name"));
    final List<String> expected = Arrays.asList("BarEntityWithId1", "BarEntityWithId2", "BarEntityWithId3",
            "BarEntityWithId4");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();/*  w  w w  .  jav a  2s  .  c om*/
}

From source file:libepg.ts.reader.Reader2Test.java

/**
 * Test of getPackets method, of class Reader2.
 *
 * @throws java.io.IOException/* w w w . j a v  a2 s  . c o  m*/
 */
@Test
public void testGetPackets_WrongLength() throws IOException {
    LOG.info("getPackets_WrongLength");
    File temp_ContainError_WrongLength = TestPacket_BitError
            .writeBytesToFile(this.list_ContainError_WrongLength);
    Reader2 instance = new Reader2(temp_ContainError_WrongLength);
    List<TsPacket> _expResult = this.expResult_Wrong_Length;
    List<TsPacket> result = instance.getPackets();
    LOG.info("expResult");
    dumpPacketList(_expResult);
    LOG.info("result");
    dumpPacketList(result);
    assertEquals(ListUtils.isEqualList(_expResult, result), true);
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityQueryTest.java

@Test
public void setFirstResult() {
    final EntityQuery<BarEntity> query = new EntityQuery<>(BarEntity.class);
    query.addOrder(Order.asc("name"));
    query.setFirstResult(1);//from ww  w  .ja v  a  2 s  . c o m

    final List<BarEntity> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntity2", "BarEntity3", "BarEntity4");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityQueryTest.java

@Test
public void setMaxResults() {
    final EntityQuery<BarEntity> query = new EntityQuery<>(BarEntity.class);
    query.addOrder(Order.asc("name"));
    query.setMaxResults(1);// w  ww  . j  a  va2 s .  c  om

    final List<BarEntity> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntity1");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityQueryTest.java

@Test
public void addOrders() {
    final EntityQuery<BarEntity> query = new EntityQuery<>(BarEntity.class);
    query.addOrder(Order.asc("active"));
    query.addOrder(Order.desc("name"));

    final List<BarEntity> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntity4", "BarEntity3", "BarEntity2", "BarEntity1");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();//w w w.  j  a va2 s.co m
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityWithIdQueryTest.java

@Test
public void setFirstResult() {
    final EntityWithIdQuery<BarEntityWithId> query = new EntityWithIdQuery<>(BarEntityWithId.class);
    query.addOrder(Order.asc("name"));
    query.setFirstResult(1);// w  w w. ja v a2  s .  c o m

    final List<BarEntityWithId> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntityWithId2", "BarEntityWithId3", "BarEntityWithId4");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityQueryTest.java

@Test
public void addRestrictions() {
    final EntityQuery<BarEntity> query = new EntityQuery<>(BarEntity.class);
    query.addRestriction(Restrictions.ge("fooId", 2l));
    query.addRestriction(Restrictions.eq("active", false));

    final List<BarEntity> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntity3", "BarEntity4");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();// www. j a va2s  .  c  o  m
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityWithIdQueryTest.java

@Test
public void setMaxResults() {
    final EntityWithIdQuery<BarEntityWithId> query = new EntityWithIdQuery<>(BarEntityWithId.class);
    query.addOrder(Order.asc("name"));
    query.setMaxResults(1);/*from  ww  w .jav  a2 s.c  o m*/

    final List<BarEntityWithId> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntityWithId1");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityWithIdQueryTest.java

@Test
public void addOrders() {
    final EntityWithIdQuery<BarEntityWithId> query = new EntityWithIdQuery<>(BarEntityWithId.class);
    query.addOrder(Order.asc("active"));
    query.addOrder(Order.desc("name"));

    final List<BarEntityWithId> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntityWithId4", "BarEntityWithId3", "BarEntityWithId2",
            "BarEntityWithId1");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();/*from  w ww  .j a  va 2 s .c  om*/
}

From source file:com.romeikat.datamessie.core.base.query.entity.EntityWithIdQueryTest.java

@Test
public void addRestrictions() {
    final EntityWithIdQuery<BarEntityWithId> query = new EntityWithIdQuery<>(BarEntityWithId.class);
    query.addRestriction(Restrictions.ge("fooId", 2l));
    query.addRestriction(Restrictions.eq("active", false));
    query.addOrder(Order.asc("name"));

    final List<BarEntityWithId> objects = query.listObjects(sessionProvider.getStatelessSession());
    final List<String> names = getNames(objects);
    final List<String> expected = Arrays.asList("BarEntityWithId3", "BarEntityWithId4");
    assertTrue(ListUtils.isEqualList(expected, names));

    dbSetupTracker.skipNextLaunch();//from   ww w . jav  a2 s. c o  m
}