1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2016 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.api.service;
|
11
|
|
12
|
import org.junit.Assert;
|
13
|
import org.junit.Test;
|
14
|
|
15
|
|
16
|
/**
|
17
|
* @author a.mueller
|
18
|
* @date 12.09.2016
|
19
|
*
|
20
|
*/
|
21
|
public class TreeIndexComparatorTest {
|
22
|
|
23
|
@Test
|
24
|
public void test() {
|
25
|
TreeIndexComparator comparator = new TreeIndexComparator();
|
26
|
|
27
|
//both null
|
28
|
Assert.assertTrue(0 == comparator.compare(null, null));
|
29
|
//one null
|
30
|
Assert.assertTrue(0 > comparator.compare(null, "#t10#10#"));
|
31
|
Assert.assertTrue(0 < comparator.compare("#t10#10#", null));
|
32
|
//equal
|
33
|
Assert.assertTrue(0 == comparator.compare("#t10#10#", "#t10#10#"));
|
34
|
|
35
|
//same start
|
36
|
Assert.assertTrue(0 > comparator.compare("#t10#10#", "#t10#10#20#"));
|
37
|
Assert.assertTrue(0 < comparator.compare("#t10#10#20#", "#t10#10#"));
|
38
|
|
39
|
//different ends
|
40
|
Assert.assertTrue(0 > comparator.compare("#t10#10#20#", "#t10#10#30#"));
|
41
|
Assert.assertTrue(0 < comparator.compare("#t10#10#30#", "#t10#10#20#"));
|
42
|
|
43
|
//different ends
|
44
|
Assert.assertTrue(0 > comparator.compare("#t10#10#20#", "#t10#10#30#"));
|
45
|
Assert.assertTrue(0 > comparator.compare("#t10#10#20#", "#t10#10#30#11"));
|
46
|
|
47
|
Assert.assertTrue(0 < comparator.compare("#t10#10#30#", "#t10#10#20#"));
|
48
|
Assert.assertTrue(0 < comparator.compare("#t10#10#30#11", "#t10#10#20#"));
|
49
|
|
50
|
}
|
51
|
|
52
|
}
|