mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
added more tests for core classes
This commit is contained in:
parent
7c2b0c139b
commit
ecd407929f
@ -0,0 +1,30 @@
|
||||
package com.mysema.query.util;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.mysema.codegen.Evaluator;
|
||||
|
||||
public class MultiComparatorTest {
|
||||
|
||||
private final Evaluator<Object[]> evaluator = new Evaluator<Object[]>() {
|
||||
@Override
|
||||
public Object[] evaluate(Object... args) {
|
||||
return args;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends Object[]> getType() {
|
||||
return Object[].class;
|
||||
}
|
||||
};
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
MultiComparator<Object[]> comparator = new MultiComparator<Object[]>(evaluator, new boolean[]{true, true});
|
||||
assertTrue(comparator.compare(new Object[]{"a", "b"}, new Object[]{"a","c"}) < 0);
|
||||
assertTrue(comparator.compare(new Object[]{"b", "a"}, new Object[]{"a","b"}) > 0);
|
||||
assertTrue(comparator.compare(new Object[]{"b", "b"}, new Object[]{"b","b"}) == 0);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.mysema.util;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ArrayUtilsTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
Object[] array = ArrayUtils.combine(5, new Object[]{"a","b"}, new Object[]{"c","d","e"});
|
||||
assertEquals(Arrays.asList("a","b","c","d","e"), Arrays.asList(array));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user