-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FORGE-2493: Fixes tests accepting invalid maven coordinates
- Loading branch information
Showing
4 changed files
with
197 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...s/api/src/test/java/org/jboss/forge/addon/dependencies/builder/CoordinateBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2015 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.jboss.forge.addon.dependencies.builder; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Ensures that {@link CoordinateBuilder} creates coordinates in the following schema: | ||
* | ||
* {@code <groupId>:<artifactId>[:<packaging>[:<classifier>]]:<version>} | ||
* | ||
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a> | ||
*/ | ||
public class CoordinateBuilderTest | ||
{ | ||
@Test | ||
public void testCreateCoordinateFromString() | ||
{ | ||
String coordinates = "org.jboss.forge.addon:projects-api:2.0.0.Final"; | ||
CoordinateBuilder coord = CoordinateBuilder.create(coordinates); | ||
Assert.assertEquals("org.jboss.forge.addon", coord.getGroupId()); | ||
Assert.assertEquals("projects-api", coord.getArtifactId()); | ||
Assert.assertNull(coord.getPackaging()); | ||
Assert.assertNull(coord.getClassifier()); | ||
Assert.assertEquals("2.0.0.Final", coord.getVersion()); | ||
Assert.assertEquals(coordinates, coord.toString()); | ||
} | ||
|
||
@Test | ||
public void testCreateVersionlessCoordinateFromString() | ||
{ | ||
String coordinates = "org.jboss.forge.addon:projects-api:"; | ||
CoordinateBuilder coord = CoordinateBuilder.create(coordinates); | ||
Assert.assertEquals("org.jboss.forge.addon", coord.getGroupId()); | ||
Assert.assertEquals("projects-api", coord.getArtifactId()); | ||
Assert.assertNull(coord.getPackaging()); | ||
Assert.assertNull(coord.getClassifier()); | ||
Assert.assertNull(coord.getVersion()); | ||
Assert.assertEquals(coordinates, coord.toString()); | ||
} | ||
|
||
} |
Oops, something went wrong.