1 package org.apache.maven.shared.transfer.dependencies.resolve.internal;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import static org.mockito.Mockito.mock;
23
24 import org.apache.maven.model.Model;
25 import org.apache.maven.project.ProjectBuildingRequest;
26 import org.apache.maven.shared.transfer.dependencies.DependableCoordinate;
27 import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolver;
28 import org.apache.maven.shared.transfer.dependencies.resolve.DependencyResolverException;
29 import org.apache.maven.shared.transfer.dependencies.resolve.internal.DefaultDependencyResolver;
30 import org.junit.Before;
31 import org.junit.Rule;
32 import org.junit.Test;
33 import org.junit.rules.ExpectedException;
34
35
36
37
38
39
40 public class DefaultDependencyResolverTest
41 {
42 @Rule
43 public ExpectedException thrown = ExpectedException.none();
44
45 private DependencyResolver dr;
46
47 @Before
48 public void setUp()
49 {
50 dr = new DefaultDependencyResolver();
51 }
52
53 @Test
54 public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterBuildingRequestIsNull()
55 throws DependencyResolverException
56 {
57 thrown.expect( IllegalArgumentException.class );
58 thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
59
60 dr.resolveDependencies( null, (DependableCoordinate) null, null );
61 }
62
63 @Test
64 public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterCoordinateIsNull()
65 throws DependencyResolverException
66 {
67 thrown.expect( IllegalArgumentException.class );
68 thrown.expectMessage( "The parameter coordinate is not allowed to be null." );
69
70 ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
71 dr.resolveDependencies( request, (DependableCoordinate) null, null );
72 }
73
74 @Test
75 public void resolveDependenciesWithDependableCoordinatShouldFailWithIAEWhenParameterFilterIsNull()
76 throws DependencyResolverException
77 {
78 thrown.expect( IllegalArgumentException.class );
79 thrown.expectMessage( "The parameter filter is not allowed to be null." );
80
81 ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
82 DependableCoordinate dc = mock( DependableCoordinate.class );
83 dr.resolveDependencies( request, dc, null );
84 }
85
86 @Test
87 public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterBuildingRequestIsNull()
88 throws DependencyResolverException
89 {
90 thrown.expect( IllegalArgumentException.class );
91 thrown.expectMessage( "The parameter buildingRequest is not allowed to be null." );
92
93 dr.resolveDependencies( null, (Model) null, null );
94 }
95
96 @Test
97 public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterModelIsNull()
98 throws DependencyResolverException
99 {
100 thrown.expect( IllegalArgumentException.class );
101 thrown.expectMessage( "The parameter model is not allowed to be null." );
102
103 ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
104 dr.resolveDependencies( request, (Model) null, null );
105 }
106
107 @Test
108 public void resolveDependenciesWithModelShouldFailWithIAEWhenParameterFilterIsNull()
109 throws DependencyResolverException
110 {
111 thrown.expect( IllegalArgumentException.class );
112 thrown.expectMessage( "The parameter filter is not allowed to be null." );
113
114 ProjectBuildingRequest request = mock( ProjectBuildingRequest.class );
115 Model model = mock( Model.class );
116 dr.resolveDependencies( request, model, null );
117 }
118
119 }