#96 - Polishing.

Fix ReleaseCommandsIntegrationTests. Guard TrainIterationConverter against invalid input.
This commit is contained in:
Mark Paluch
2018-12-12 14:50:10 +01:00
parent 17b8c78cfe
commit 0e6c9ae37c
2 changed files with 7 additions and 2 deletions

View File

@@ -49,6 +49,11 @@ public class TrainIterationConverter implements Converter<TrainIteration> {
public TrainIteration convertFromText(String value, Class<?> targetType, String optionContext) {
String[] parts = value.split(" ");
if (parts.length != 2) {
throw new IllegalArgumentException(String.format("Cannot resolve TrainIteration from '%s'", value));
}
Train train = ReleaseTrains.getTrainByName(parts[0].trim());
Iteration iteration = train.getIteration(parts[1].trim());

View File

@@ -54,8 +54,8 @@ public class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
@Test
public void predictsReleaseTrainCorrectly() throws Exception {
git.update(ReleaseTrains.GOSLING);
git.update(ReleaseTrains.MOORE);
assertThat(releaseCommands.predictTrainAndIteration(), is("Gosling"));
assertThat(releaseCommands.predictTrainAndIteration(), is("Moore"));
}
}