@@ -165,26 +165,27 @@ public void testDeployIfClassifierIsSet(DeployFileMojo mojo) throws Exception {
165165 String version = (String ) getVariableValueFromObject (mojo , "version" );
166166 String url = (String ) getVariableValueFromObject (mojo , "url" );
167167
168- ArtifactDeployerRequest request = execute (mojo );
169-
170- assertNotNull (request );
171- List <Artifact > artifacts = new ArrayList <>(request .getArtifacts ());
172- assertEquals (2 , artifacts .size ());
173- // first artifact
174- Artifact a1 = artifacts .get (0 );
175- assertEquals (new ArtifactStub (groupId , artifactId , "bin" , version , "jar" ), a1 );
176- Path p1 = artifactManager .getPath (a1 ).orElse (null );
177- assertNotNull (p1 );
178- assertTrue (p1 .toString ().endsWith ("maven-deploy-test-1.0-SNAPSHOT.jar" ));
179- // second artifact
180- Artifact a2 = artifacts .get (1 );
181- assertEquals (new ArtifactStub (groupId , artifactId , "" , version , "pom" ), a2 );
182- Path p2 = artifactManager .getPath (a2 ).orElse (null );
183- assertNotNull (p2 );
184- assertTrue (p2 .toString ().endsWith (".pom" ));
185- // remote repository
186- assertNotNull (request .getRepository ());
187- assertEquals (url .replace (File .separator , "/" ), request .getRepository ().getUrl ());
168+ execute (mojo , request -> {
169+ assertNotNull (request );
170+ List <Artifact > artifacts = new ArrayList <>(request .getArtifacts ());
171+ assertEquals (2 , artifacts .size ());
172+ // first artifact
173+ Artifact a1 = artifacts .get (0 );
174+ assertEquals (new ArtifactStub (groupId , artifactId , "bin" , version , "jar" ), a1 );
175+ Path p1 = artifactManager .getPath (a1 ).orElse (null );
176+ assertNotNull (p1 );
177+ assertTrue (p1 .toString ().endsWith ("maven-deploy-test-1.0-SNAPSHOT.jar" ));
178+ // second artifact
179+ Artifact a2 = artifacts .get (1 );
180+ assertEquals (new ArtifactStub (groupId , artifactId , "" , version , "pom" ), a2 );
181+ Path p2 = artifactManager .getPath (a2 ).orElse (null );
182+ assertNotNull (p2 );
183+ assertTrue (p2 .toString ().endsWith (".pom" ));
184+ // remote repository
185+ assertNotNull (request .getRepository ());
186+ assertEquals (
187+ url .replace (File .separator , "/" ), request .getRepository ().getUrl ());
188+ });
188189 }
189190
190191 @ Test
@@ -206,24 +207,24 @@ public void testDeployIfArtifactIsNotJar(DeployFileMojo mojo) throws Exception {
206207 assertEquals ("maven-deploy-file-test" , artifactId );
207208 assertEquals ("1.0" , version );
208209
209- ArtifactDeployerRequest request = execute ( mojo );
210-
211- assertNotNull (request );
212- List < Artifact > artifacts = new ArrayList <>( request . getArtifacts ());
213- assertEquals ( 2 , artifacts .size () );
214- Artifact a1 = artifacts .get (0 );
215- Artifact a2 = artifacts . get ( 1 );
216- Path p1 = artifactManager .getPath (a1 ).orElse (null );
217- Path p2 = artifactManager . getPath ( a2 ). orElse ( null );
218- assertNotNull (p1 );
219- assertTrue ( p1 . toString (). endsWith ( "maven-deploy-test.zip" ) );
220- assertNotNull (p2 );
221- assertTrue ( p2 . toString (). endsWith ( ".pom" ));
222-
223- assertNotNull ( request . getRepository ());
224- assertEquals (
225- "file://" + getBasedir ().replace ( File . separator , "/" ) + "/target/remote-repo/deploy-file" ,
226- request . getRepository (). getUrl () );
210+ execute ( mojo , request -> {
211+ assertNotNull ( request );
212+ List < Artifact > artifacts = new ArrayList <> (request . getArtifacts () );
213+ assertEquals ( 2 , artifacts . size ());
214+ Artifact a1 = artifacts .get ( 0 );
215+ Artifact a2 = artifacts .get (1 );
216+ Path p1 = artifactManager . getPath ( a1 ). orElse ( null );
217+ Path p2 = artifactManager .getPath (a2 ).orElse (null );
218+ assertNotNull ( p1 );
219+ assertTrue (p1 . toString (). endsWith ( "maven-deploy-test.zip" ) );
220+ assertNotNull ( p2 );
221+ assertTrue (p2 . toString (). endsWith ( ".pom" ) );
222+
223+ assertNotNull ( request . getRepository ());
224+ assertEquals (
225+ "file://" + getBasedir (). replace ( File . separator , "/" ) + "/target/remote-repo/deploy-file" ,
226+ request . getRepository ().getUrl ());
227+ } );
227228 }
228229
229230 private ArtifactDeployerRequest execute (DeployFileMojo mojo ) {
0 commit comments