1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.common.util.metainf.model;
17  
18  import org.junit.Assert;
19  import org.junit.Test;
20  import org.kuali.common.util.log.LoggerUtils;
21  import org.slf4j.Logger;
22  
23  public class PathComparatorTest {
24  
25  	private static final Logger logger = LoggerUtils.make();
26  
27  	@Test
28  	public void testCompare() {
29  		PathComparator instance = new PathComparator();
30  		try {
31  			instance.compare(-1, new String[] { "" }, new String[] { "" });
32  			Assert.fail();
33  		} catch (IllegalArgumentException e) {
34  			logger.info(e.getMessage());
35  		}
36  		try {
37  			instance.compare(1, new String[] { "" }, new String[] { "" });
38  			Assert.fail();
39  		} catch (IllegalArgumentException e) {
40  			logger.info(e.getMessage());
41  		}
42  		try {
43  			instance.compare(1, new String[] { "", "" }, new String[] { "" });
44  			Assert.fail();
45  		} catch (IllegalArgumentException e) {
46  			logger.info(e.getMessage());
47  		}
48  	}
49  
50  	@Test
51  	public void testCompareTokens() {
52  		PathComparator instance = new PathComparator();
53  		String[] two = { "a", "b" };
54  		String[] three = { "a", "b", "c" };
55  		Assert.assertEquals(-1, instance.compare(two, three));
56  		Assert.assertEquals(1, instance.compare(three, two));
57  	}
58  }