You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2014/03/14 15:54:14 UTC
svn commit: r1577557 -
/tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
Author: kkolinko
Date: Fri Mar 14 14:54:13 2014
New Revision: 1577557
URL: http://svn.apache.org/r1577557
Log:
Better reporting for skipped tests.
With org.junit.Assume the tests are clearly reported as 'skipped' in JUnit test run summary.
Modified:
tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
Modified: tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java?rev=1577557&r1=1577556&r2=1577557&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original)
+++ tomcat/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Fri Mar 14 14:54:13 2014
@@ -33,6 +33,7 @@ import static org.junit.Assert.assertTru
import static org.junit.Assert.fail;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
import org.apache.catalina.Context;
@@ -50,11 +51,9 @@ public class TestCometProcessor extends
@Test
public void testAsyncClose() throws Exception {
-
- if (!isCometSupported()) {
- log.info("This test is skipped, because this connector does not support Comet.");
- return;
- }
+ Assume.assumeTrue(
+ "This test is skipped, because this connector does not support Comet.",
+ isCometSupported());
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
@@ -119,11 +118,9 @@ public class TestCometProcessor extends
@Test
public void testSyncClose() throws Exception {
-
- if (!isCometSupported()) {
- log.info("This test is skipped, because this connector does not support Comet.");
- return;
- }
+ Assume.assumeTrue(
+ "This test is skipped, because this connector does not support Comet.",
+ isCometSupported());
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
@@ -192,11 +189,9 @@ public class TestCometProcessor extends
@Test
public void testConnectionClose() throws Exception {
-
- if (!isCometSupported()) {
- log.info("This test is skipped, because this connector does not support Comet.");
- return;
- }
+ Assume.assumeTrue(
+ "This test is skipped, because this connector does not support Comet.",
+ isCometSupported());
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
@@ -267,10 +262,9 @@ public class TestCometProcessor extends
}
private void doSimpleCometTest(String initParam) throws Exception {
- if (!isCometSupported()) {
- log.info("This test is skipped, because this connector does not support Comet.");
- return;
- }
+ Assume.assumeTrue(
+ "This test is skipped, because this connector does not support Comet.",
+ isCometSupported());
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
@@ -362,11 +356,9 @@ public class TestCometProcessor extends
*/
@Test
public void testCometConnectorStop() throws Exception {
-
- if (!isCometSupported()) {
- log.info("This test is skipped, because this connector does not support Comet.");
- return;
- }
+ Assume.assumeTrue(
+ "This test is skipped, because this connector does not support Comet.",
+ isCometSupported());
// Setup Tomcat instance
SimpleCometServlet servlet = new SimpleCometServlet();
@@ -461,11 +453,7 @@ public class TestCometProcessor extends
private boolean isCometSupported() {
String protocol =
getTomcatInstance().getConnector().getProtocolHandlerClassName();
- if (protocol.indexOf("Nio") == -1 && protocol.indexOf("Apr") == -1) {
- return false;
- } else {
- return true;
- }
+ return (protocol.contains("Nio") || protocol.contains("Apr"));
}
private static class SimpleCometServlet extends HttpServlet
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org