Пример #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());
  }
Пример #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);
 }
Пример #4
0
 @Test
 public void testInstancesWithDifferentVersionsCompareUnequally() {
   assertFalse(GAV_1A.compareTo(GAV_2) == 0);
 }
Пример #5
0
 @Test
 public void testInstancesWithSameCoordinatesCompareEqually() {
   assertEquals(0, GAV_1A.compareTo(GAV_1B));
 }
Пример #6
0
 @Test
 public void testInstancesWithSameCoordinatesHaveSameHashCode() {
   assertEquals(GAV_1A.hashCode(), GAV_1B.hashCode());
 }
Пример #7
0
 @Test
 public void testInstancesWithDifferentVersionsAreNotEqual() {
   assertFalse(GAV_1A.equals(GAV_2));
   assertFalse(GAV_2.equals(GAV_1A));
 }
Пример #8
0
 @Test
 public void testInstancesWithSameCoordinatesAreEqual() {
   assertTrue(GAV_1A.equals(GAV_1B));
   assertTrue(GAV_1B.equals(GAV_1A));
 }