001package org.kuali.common.util.metainf.model; 002 003import org.junit.Assert; 004import org.junit.Test; 005import org.kuali.common.util.log.LoggerUtils; 006import org.slf4j.Logger; 007 008public class PathComparatorTest { 009 010 private static final Logger logger = LoggerUtils.make(); 011 012 @Test 013 public void testCompare() { 014 PathComparator instance = new PathComparator(); 015 try { 016 instance.compare(-1, new String[] { "" }, new String[] { "" }); 017 Assert.fail(); 018 } catch (IllegalArgumentException e) { 019 logger.info(e.getMessage()); 020 } 021 try { 022 instance.compare(1, new String[] { "" }, new String[] { "" }); 023 Assert.fail(); 024 } catch (IllegalArgumentException e) { 025 logger.info(e.getMessage()); 026 } 027 try { 028 instance.compare(1, new String[] { "", "" }, new String[] { "" }); 029 Assert.fail(); 030 } catch (IllegalArgumentException e) { 031 logger.info(e.getMessage()); 032 } 033 } 034 035 @Test 036 public void testCompareTokens() { 037 PathComparator instance = new PathComparator(); 038 String[] two = { "a", "b" }; 039 String[] three = { "a", "b", "c" }; 040 Assert.assertEquals(-1, instance.compare(two, three)); 041 Assert.assertEquals(1, instance.compare(three, two)); 042 } 043}