Search in sources :

Example 1 with InvalidSCMRevisionDataException

use of com.thoughtworks.go.plugin.access.scm.exceptions.InvalidSCMRevisionDataException in project gocd by gocd.

the class SCMRevisionTest method shouldThrowExceptionIfDataKeyContainsCharactersOtherThanAlphaNumericAndUnderScoreCharacters.

@Test
public void shouldThrowExceptionIfDataKeyContainsCharactersOtherThanAlphaNumericAndUnderScoreCharacters() throws Exception {
    SCMRevision scmRevision = new SCMRevision("rev123", new Date(), "loser", null, null, null);
    try {
        scmRevision.addData("HEL-LO-WORLD", "value");
        fail("should have thrown exception");
    } catch (InvalidSCMRevisionDataException e) {
        assertThat(e.getMessage(), is("Key 'HEL-LO-WORLD' is invalid. Key names should consists of only alphanumeric characters and/or underscores."));
    }
}
Also used : InvalidSCMRevisionDataException(com.thoughtworks.go.plugin.access.scm.exceptions.InvalidSCMRevisionDataException) SCMRevision(com.thoughtworks.go.plugin.access.scm.revision.SCMRevision) Date(java.util.Date) Test(org.junit.Test)

Aggregations

InvalidSCMRevisionDataException (com.thoughtworks.go.plugin.access.scm.exceptions.InvalidSCMRevisionDataException)1 SCMRevision (com.thoughtworks.go.plugin.access.scm.revision.SCMRevision)1 Date (java.util.Date)1 Test (org.junit.Test)1