コード例 #1
0
ファイル: ModelMapperTest.java プロジェクト: mgaunin/Grapes
  @Test
  public void testGetArtifact() {
    final DbArtifact dbArtifact = new DbArtifact();
    dbArtifact.setGroupId("groupId");
    dbArtifact.setArtifactId("artifactId");
    dbArtifact.setVersion("1.0.0-SNAPSHOT");
    dbArtifact.setClassifier("win");
    dbArtifact.setType("component");
    dbArtifact.setExtension("jar");
    dbArtifact.setDownloadUrl("nowhere");
    dbArtifact.setSize("10Mo");
    dbArtifact.setProvider("provider");

    final DbLicense license = new DbLicense();
    license.setName("licenseId");
    dbArtifact.addLicense(license);

    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final Artifact artifact = modelMapper.getArtifact(dbArtifact);

    assertEquals(dbArtifact.getGroupId(), artifact.getGroupId());
    assertEquals(dbArtifact.getArtifactId(), artifact.getArtifactId());
    assertEquals(dbArtifact.getVersion(), artifact.getVersion());
    assertEquals(dbArtifact.getClassifier(), artifact.getClassifier());
    assertEquals(dbArtifact.getType(), artifact.getType());
    assertEquals(dbArtifact.getExtension(), artifact.getExtension());
    assertEquals(dbArtifact.getSize(), artifact.getSize());
    assertEquals(dbArtifact.getDownloadUrl(), artifact.getDownloadUrl());
    assertEquals(dbArtifact.getProvider(), artifact.getProvider());
    assertEquals(1, artifact.getLicenses().size());
    assertEquals("licenseId", artifact.getLicenses().get(0));
  }
コード例 #2
0
ファイル: ModelMapperTest.java プロジェクト: mgaunin/Grapes
  @Test
  public void testGetUnknownLicense() throws Exception {
    final DbLicense dbLicense = new DbLicense();
    dbLicense.setName("name");
    dbLicense.setLongName("");
    dbLicense.setComments("");
    dbLicense.setRegexp("");
    dbLicense.setUrl("");

    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final License license = modelMapper.getLicense(dbLicense);

    assertEquals(true, license.isUnknown());
  }
コード例 #3
0
ファイル: ModelMapperTest.java プロジェクト: mgaunin/Grapes
  @Test
  public void testGetLicense() throws Exception {
    final DbLicense dbLicense = new DbLicense();
    dbLicense.setName("name");
    dbLicense.setLongName("long name");
    dbLicense.setComments("comment");
    dbLicense.setRegexp("regexp");
    dbLicense.setUrl("url");

    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final License license = modelMapper.getLicense(dbLicense);

    assertEquals(dbLicense.getName(), license.getName());
    assertEquals(dbLicense.getLongName(), license.getLongName());
    assertEquals(dbLicense.getComments(), license.getComments());
    assertEquals(dbLicense.getRegexp(), license.getRegexp());
    assertEquals(dbLicense.getUrl(), license.getUrl());
  }