Ejemplo n.º 1
0
  @Test
  public void testConstructorAndGetters() {
    // Set up

    // Invoke
    final GAV gav = new GAV(GROUP_ID, ARTIFACT_ID, VERSION);

    // Check
    assertEquals(GROUP_ID, gav.getGroupId());
    assertEquals(ARTIFACT_ID, gav.getArtifactId());
    assertEquals(VERSION, gav.getVersion());
  }
Ejemplo n.º 2
0
  @Test
  public void testGetInstance() {
    // Set up
    final String coordinates =
        StringUtils.arrayToDelimitedString(
            new String[] {GROUP_ID, ARTIFACT_ID, VERSION}, MavenUtils.COORDINATE_SEPARATOR);

    // Invoke
    final GAV gav = GAV.getInstance(coordinates);

    // Check
    assertEquals(GROUP_ID, gav.getGroupId());
    assertEquals(ARTIFACT_ID, gav.getArtifactId());
    assertEquals(VERSION, gav.getVersion());
  }
 public void createModule(
     final JavaPackage topLevelPackage,
     final String name,
     final GAV parent,
     final PackagingType packagingType) {
   Assert.isTrue(isCreateModuleAvailable(), "Cannot create modules at this time");
   final String moduleName = StringUtils.defaultIfEmpty(name, topLevelPackage.getLastElement());
   final GAV module =
       new GAV(topLevelPackage.getFullyQualifiedPackageName(), moduleName, parent.getVersion());
   final ProjectMetadata project = getProjectMetadata();
   // TODO create or update "modules" element of parent module's POM
   // Create the new module's directory, named by its artifactId (Maven standard practice)
   fileManager.createDirectory(moduleName);
   // Focus the new module so that artifacts created below go to the correct path(s)
   focus(module);
   packagingType.createArtifacts(topLevelPackage, name, "${java.version}", parent);
 }
Ejemplo n.º 4
0
 @Test
 public void testInstancesWithDifferentVersionsCompareUnequally() {
   assertFalse(GAV_1A.compareTo(GAV_2) == 0);
 }
Ejemplo n.º 5
0
 @Test
 public void testInstancesWithSameCoordinatesCompareEqually() {
   assertEquals(0, GAV_1A.compareTo(GAV_1B));
 }
Ejemplo n.º 6
0
 @Test
 public void testInstancesWithSameCoordinatesHaveSameHashCode() {
   assertEquals(GAV_1A.hashCode(), GAV_1B.hashCode());
 }
Ejemplo n.º 7
0
 @Test
 public void testInstancesWithDifferentVersionsAreNotEqual() {
   assertFalse(GAV_1A.equals(GAV_2));
   assertFalse(GAV_2.equals(GAV_1A));
 }
Ejemplo n.º 8
0
 @Test
 public void testInstancesWithSameCoordinatesAreEqual() {
   assertTrue(GAV_1A.equals(GAV_1B));
   assertTrue(GAV_1B.equals(GAV_1A));
 }