1 package org.apache.maven.archiva.model;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import junit.framework.TestCase;
23
24
25
26
27
28
29 public class DependencyScopeTest
30 extends TestCase
31 {
32 public void testIsWithinScope()
33 {
34
35 assertFalse( DependencyScope.isWithinScope( "compile", null ) );
36 assertFalse( DependencyScope.isWithinScope( "test", null ) );
37 assertFalse( DependencyScope.isWithinScope( "runtime", null ) );
38 assertFalse( DependencyScope.isWithinScope( "provided", null ) );
39 assertFalse( DependencyScope.isWithinScope( "compile", "" ) );
40 assertFalse( DependencyScope.isWithinScope( "test", "" ) );
41 assertFalse( DependencyScope.isWithinScope( "runtime", "" ) );
42 assertFalse( DependencyScope.isWithinScope( "provided", "" ) );
43
44
45 assertTrue( DependencyScope.isWithinScope( "", DependencyScope.COMPILE ) );
46 assertTrue( DependencyScope.isWithinScope( null, DependencyScope.COMPILE ) );
47 assertTrue( DependencyScope.isWithinScope( "", DependencyScope.TEST ) );
48 assertTrue( DependencyScope.isWithinScope( null, DependencyScope.TEST ) );
49 assertFalse( DependencyScope.isWithinScope( "", DependencyScope.PROVIDED ) );
50 assertFalse( DependencyScope.isWithinScope( null, DependencyScope.PROVIDED ) );
51 assertFalse( DependencyScope.isWithinScope( "", DependencyScope.RUNTIME ) );
52 assertFalse( DependencyScope.isWithinScope( null, DependencyScope.RUNTIME ) );
53
54
55 assertTrue( DependencyScope.isWithinScope( "compile", DependencyScope.COMPILE ) );
56 assertFalse( DependencyScope.isWithinScope( "test", DependencyScope.COMPILE ) );
57
58
59 assertTrue( DependencyScope.isWithinScope( "compile", DependencyScope.TEST ) );
60 assertTrue( DependencyScope.isWithinScope( "test", DependencyScope.TEST ) );
61
62
63 assertFalse( DependencyScope.isWithinScope( "compile", DependencyScope.PROVIDED ) );
64 assertFalse( DependencyScope.isWithinScope( "test", DependencyScope.PROVIDED ) );
65 assertTrue( DependencyScope.isWithinScope( "provided", DependencyScope.PROVIDED ) );
66
67 assertFalse( DependencyScope.isWithinScope( "compile", DependencyScope.RUNTIME ) );
68 assertFalse( DependencyScope.isWithinScope( "test", DependencyScope.RUNTIME ) );
69 assertTrue( DependencyScope.isWithinScope( "provided", DependencyScope.RUNTIME ) );
70 assertTrue( DependencyScope.isWithinScope( "runtime", DependencyScope.RUNTIME ) );
71 }
72 }