Skip to content

Commit

Permalink
rename exceptionRule to exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanbrainard committed Apr 4, 2012
1 parent 0449306 commit 897516d
Showing 1 changed file with 18 additions and 18 deletions.
Expand Up @@ -27,7 +27,7 @@ public class DirectToHerokuClientTest {
private final DirectToHerokuClient client = new DirectToHerokuClient(apiKey);

@Rule
public final ExpectedException exceptionRule = ExpectedException.none();
public final ExpectedException exceptions = ExpectedException.none();

@Test
public void testGetPipelineNames() throws Exception {
Expand Down Expand Up @@ -55,31 +55,31 @@ public void testDeploy() throws Exception {
public void testDeploy_NoApiKeySet() throws Exception {
final DirectToHerokuClient clientWithNoApiKeySet = new DirectToHerokuClient("");

exceptionRule.expect(DeploymentException.class);
exceptionRule.expectMessage("Unable to get user info");
exceptions.expect(DeploymentException.class);
exceptions.expectMessage("Unable to get user info");
clientWithNoApiKeySet.deploy(WAR_PIPELINE, appName, warBundle);
}

@Test
public void testDeploy_NoAccessToApp() throws Exception {
exceptionRule.expect(DeploymentException.class);
exceptionRule.expectMessage("not part of app");
exceptions.expect(DeploymentException.class);
exceptions.expectMessage("not part of app");
client.deploy(WAR_PIPELINE, UUID.randomUUID().toString(), warBundle);
}

@Test
public void testDeploy_BadResponse() throws Exception {
final DirectToHerokuClient badClient = new DirectToHerokuClient("http", "example.com", 80, apiKey);

exceptionRule.expect(DeploymentException.class);
exceptionRule.expectMessage("Deploy not accepted");
exceptions.expect(DeploymentException.class);
exceptions.expectMessage("Deploy not accepted");
badClient.deploy(WAR_PIPELINE, appName, warBundle);
}

@Test
public void testDeploy_InvalidRequiredFiles() throws Exception {
exceptionRule.expect(DeploymentException.class);
exceptionRule.expectMessage("fatjar requires the following file params:jar, procfile");
exceptions.expect(DeploymentException.class);
exceptions.expectMessage("fatjar requires the following file params:jar, procfile");
client.deploy(FATJAR_PIPELINE, appName, warBundle);
}

Expand All @@ -88,8 +88,8 @@ public void testDeploy_WithoutTimeout() throws Exception {
DirectToHerokuClient clientWithShortTimeout = new DirectToHerokuClient(apiKey);
clientWithShortTimeout.setPollingTimeout(1);

exceptionRule.expect(DeploymentException.class);
exceptionRule.expectMessage("Polling timed out");
exceptions.expect(DeploymentException.class);
exceptions.expectMessage("Polling timed out");
clientWithShortTimeout.deploy(WAR_PIPELINE, appName, warBundle);
}

Expand All @@ -100,8 +100,8 @@ public void testVerify_Pass() throws Exception {

@Test
public void testVerify_InvalidPipelineName() throws Exception {
exceptionRule.expect(VerificationException.class);
exceptionRule.expectMessage("[Invalid pipeline name");
exceptions.expect(VerificationException.class);
exceptions.expectMessage("[Invalid pipeline name");
client.verify("BAD_PIPELINE_NAME", "anApp", warBundle);
}

Expand All @@ -110,11 +110,11 @@ public void testVerify_InvalidMisc() throws Exception {
final HashMap<String, File> files = new HashMap<String, File>();
files.put("meaningless", new File("i'm not really here"));

exceptionRule.expect(VerificationException.class);
exceptionRule.expectMessage("App name must be populated");
exceptionRule.expectMessage("Required file not specified: jar (the fat jar)");
exceptionRule.expectMessage("Required file not specified: procfile (The Procfile)");
exceptionRule.expectMessage("File not found for: meaningless (i'm not really here)");
exceptions.expect(VerificationException.class);
exceptions.expectMessage("App name must be populated");
exceptions.expectMessage("Required file not specified: jar (the fat jar)");
exceptions.expectMessage("Required file not specified: procfile (The Procfile)");
exceptions.expectMessage("File not found for: meaningless (i'm not really here)");
client.verify(FATJAR_PIPELINE, "", files);
}

Expand Down

0 comments on commit 897516d

Please sign in to comment.