Exemple #1
0
 @Theory
 public void shouldGetLatestModificationsForGivenMaterial(RequestDataPoints data) {
   MaterialService spy = spy(materialService);
   doReturn(data.klass).when(spy).getMaterialClass(data.material);
   List<Modification> actual = spy.latestModification(data.material, null, null);
   assertThat(actual, is(MODIFICATIONS));
 }
Exemple #2
0
 @Test
 public void shouldThrowExceptionWhenPollerForMaterialNotFound() {
   try {
     materialService.latestModification(mock(Material.class), null, null);
     fail("Should have thrown up");
   } catch (RuntimeException e) {
     assertThat(e.getMessage(), is("unknown material type null"));
   }
 }
Exemple #3
0
  @Test
  public void shouldGetLatestModificationForPackageMaterial() {
    PackageMaterial material = new PackageMaterial();
    PackageDefinition packageDefinition =
        create(
            "id",
            "package",
            new Configuration(),
            PackageRepositoryMother.create(
                "id", "name", "plugin-id", "plugin-version", new Configuration()));
    material.setPackageDefinition(packageDefinition);

    when(pluginManager.doOn(
            eq(PackageMaterialProvider.class), eq("plugin-id"), any(ActionWithReturn.class)))
        .thenReturn(new PackageRevision("blah-123", new Date(), "user"));

    List<Modification> modifications = materialService.latestModification(material, null, null);
    assertThat(modifications.get(0).getRevision(), is("blah-123"));
  }