Skip to content

Instantly share code, notes, and snippets.

@svacas
Created October 12, 2011 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svacas/1281201 to your computer and use it in GitHub Desktop.
Save svacas/1281201 to your computer and use it in GitHub Desktop.
BMUnit test using Mule 3.2
@RunWith(BMUnitRunner.class)
public class FtpErrorTestCase extends AbstractFtpServerTestCase
{
public FtpErrorTestCase()
{
super(ConfigVariant.FLOW, "ftp-message-requester-test.xml");
}
@BMRule(name = "throw ftp exception",
targetClass = "FTPClient",
targetMethod = "retrieveFile(String, OutputStream)",
condition = "true",
action = "throw new org.apache.commons.net.ftp.FTPConnectionClosedException(\"by byteman\")")
@Test(expected = MuleException.class)
public void testFtpServiceNotAvailable() throws Exception
{
createFileOnFtpServer("test.txt");
MuleClient client = new MuleClient(muleContext);
client.request(getMuleFtpEndpoint(), getTimeout());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment