Search in sources :

Example 1 with StringContains.containsString

use of org.hamcrest.core.StringContains.containsString in project gocd by gocd.

the class HgMaterialTest method shouldThrowExceptionWithUsefulInfoIfFailedToFindModifications.

@Test
public void shouldThrowExceptionWithUsefulInfoIfFailedToFindModifications() throws Exception {
    final String url = "/tmp/notExistDir";
    hgMaterial = MaterialsMother.hgMaterial(url);
    try {
        hgMaterial.latestModification(workingFolder, new TestSubprocessExecutionContext());
        fail("Should have thrown an exception when failed to clone from an invalid url");
    } catch (Exception e) {
        assertThat(e.getMessage(), StringContains.containsString("abort: repository " + url + " not found!"));
    }
}
Also used : StringContains.containsString(org.hamcrest.core.StringContains.containsString) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 Test (org.junit.Test)1