Search in sources :

Example 91 with Material

use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.

the class LegacyMaterialCheckerTest method shouldThrowAnExceptionWhenAMaterialReturnsAnEmptyListForLatestModifications.

@Test
public void shouldThrowAnExceptionWhenAMaterialReturnsAnEmptyListForLatestModifications() {
    Material material = mock(Material.class);
    when(materialService.latestModification(material, file, null)).thenReturn(new ArrayList<>());
    when(material.toString()).thenReturn("material");
    try {
        checker.findLatestModification(file, material, null);
        fail("Should have failed since the latest modification check failed");
    } catch (RuntimeException e) {
        assertThat(e.getMessage(), is("Latest modifications check for the material 'material' returned an empty modification list. This might be because the material might be wrongly configured."));
    }
}
Also used : Material(com.thoughtworks.go.domain.materials.Material) Test(org.junit.Test)

Aggregations

Material (com.thoughtworks.go.domain.materials.Material)91 Test (org.junit.Test)58 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)38 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)36 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)22 Modification (com.thoughtworks.go.domain.materials.Modification)20 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)16 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)15 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)14 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)14 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)13 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)10 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)10 Materials (com.thoughtworks.go.config.materials.Materials)10 Date (java.util.Date)9 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)8 MaterialConfig (com.thoughtworks.go.domain.materials.MaterialConfig)8 P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)7 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)7 DependencyMaterialRevision (com.thoughtworks.go.domain.materials.dependency.DependencyMaterialRevision)7