Logo Search packages:      
Sourcecode: maven-repo-helper version File versions

DependencyRuleTest.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.debian.maven.repo;

import junit.framework.TestCase;

/**
 *
 * @author ludo
 */
00014 public class DependencyRuleTest extends TestCase {
    
    /**
     * Test of matches method, of class DependencyRule.
     */
00019     public void testMatches() {
        Dependency dependency = new Dependency("javax.servlet", "servlet-api", "jar", "2.3");
        DependencyRule generic = new DependencyRule("");
        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
        DependencyRule log4j12 = new DependencyRule("log4j log4j jar s/1\\.2\\..*/1.2.x/");
        assertTrue(generic.matches(dependency));
        assertTrue(servlet23.matches(dependency));
        assertFalse(log4j12.matches(dependency));
    }

    /**
     * Test of apply method, of class DependencyRule.
     */
00032     public void testApply() {
        Dependency dependency = new Dependency("javax.servlet", "servlet-api", "jar", "2.3");
        DependencyRule generic = new DependencyRule("");
        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
        assertEquals(new Dependency("javax.servlet", "servlet-api", "jar", "debian"), generic.apply(dependency));
        assertEquals(new Dependency("javax.servlet", "servlet-api", "jar", "2.3"), servlet23.apply(dependency));
    }

    /**
     * Test of compareTo method, of class DependencyRule.
     */
00043     public void testCompareTo() {
        DependencyRule generic = new DependencyRule("");
        DependencyRule servlet23 = new DependencyRule("javax.servlet * * 2.3");
        DependencyRule log4j12 = new DependencyRule("log4j log4j jar s/1\\.2\\..*/1.2.x/");
        assertTrue(generic.compareTo(servlet23) > 0);
        assertTrue(generic.compareTo(log4j12) > 0);
        assertTrue(servlet23.compareTo(log4j12) > 0);
        assertTrue(servlet23.compareTo(generic) < 0);
        assertTrue(log4j12.compareTo(servlet23) < 0);
        assertEquals(0, servlet23.compareTo(servlet23));
    }

}

Generated by  Doxygen 1.6.0   Back to index