Beispiel #1
0
  @Test
  public void getDependencyFromDbDependency() {
    final DbArtifact dbArtifact = new DbArtifact();
    dbArtifact.setGroupId("org.axway.grapes");
    dbArtifact.setArtifactId("artifact1");
    dbArtifact.setVersion("1.0.0-SNAPSHOT");
    dbArtifact.setExtension("jar");

    final DbDependency dbDependency = new DbDependency();
    dbDependency.setScope(Scope.RUNTIME);
    dbDependency.setTarget(dbArtifact.getGavc());

    final RepositoryHandler repositoryHandler = mock(RepositoryHandler.class);
    when(repositoryHandler.getArtifact(dbArtifact.getGavc())).thenReturn(dbArtifact);

    final ModelMapper modelMapper = new ModelMapper(repositoryHandler);
    final Dependency dependency = modelMapper.getDependency(dbDependency, "sourceName", "123456");

    assertEquals(dbDependency.getTarget(), dependency.getTarget().getGavc());
    assertEquals(dbDependency.getScope(), dependency.getScope());
    assertEquals("sourceName", dependency.getSourceName());
    assertEquals("123456", dependency.getSourceVersion());
  }