Browse Source

Adjust column selection unit test

tags/release-2.0.0
James Moger 8 years ago
parent
commit
e3d0688e8c

+ 2
- 2
src/test/java/com/iciql/test/ModelsTest.java View File

assertEquals(10, myStrings.size()); assertEquals(10, myStrings.size());


List<Integer> ids = db.from(SupportedTypes.SAMPLE) List<Integer> ids = db.from(SupportedTypes.SAMPLE)
.orderByDesc(SupportedTypes.SAMPLE.id)
.selectDistinct(SupportedTypes.SAMPLE.id);
.orderByDesc(SupportedTypes.SAMPLE.myInteger)
.selectDistinct(SupportedTypes.SAMPLE.myInteger);
assertEquals(10, ids.size()); assertEquals(10, ids.size());
assertEquals("[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]", ids.toString()); assertEquals("[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]", ids.toString());
} }

+ 4
- 3
src/test/java/com/iciql/test/models/SupportedTypes.java View File

private Short myShort; private Short myShort;


@IQColumn @IQColumn
private Integer myInteger;
public Integer myInteger;


@IQColumn @IQColumn
private Long myLong; private Long myLong;


long oneday = 24 * 60 * 60 * 1000L; long oneday = 24 * 60 * 60 * 1000L;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
list.add(randomValue(now - (i * oneday)));
SupportedTypes s = randomValue(now - (i * oneday));
s.myInteger = i + 1;
list.add(s);
} }
return list; return list;
} }
s.myBool = new Boolean(rand.nextBoolean()); s.myBool = new Boolean(rand.nextBoolean());
s.myByte = new Byte((byte) rand.nextInt(Byte.MAX_VALUE)); s.myByte = new Byte((byte) rand.nextInt(Byte.MAX_VALUE));
s.myShort = new Short((short) rand.nextInt(Short.MAX_VALUE)); s.myShort = new Short((short) rand.nextInt(Short.MAX_VALUE));
s.myInteger = new Integer(rand.nextInt());
s.myLong = new Long(rand.nextLong()); s.myLong = new Long(rand.nextLong());
s.myFloat = new Float(rand.nextFloat()); s.myFloat = new Float(rand.nextFloat());
s.myDouble = new Double(rand.nextDouble()); s.myDouble = new Double(rand.nextDouble());

Loading…
Cancel
Save