Making test more clear on assertion and failure (to help with windows failure)

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@3259 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Joakim Erdfelt 2011-05-25 22:26:37 +00:00
parent a00f7945a6
commit 52820832a1
2 changed files with 35 additions and 49 deletions

View File

@ -69,6 +69,12 @@
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<version>1.5-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId> <artifactId>jetty-webapp</artifactId>
@ -91,15 +97,5 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -15,9 +15,9 @@
// ======================================================================== // ========================================================================
package org.eclipse.jetty.deploy.bindings; package org.eclipse.jetty.deploy.bindings;
import java.io.File; import static org.hamcrest.Matchers.*;
import junit.framework.Assert; import java.io.File;
import org.eclipse.jetty.deploy.providers.ScanningAppProvider; import org.eclipse.jetty.deploy.providers.ScanningAppProvider;
import org.eclipse.jetty.deploy.test.XmlConfiguredJetty; import org.eclipse.jetty.deploy.test.XmlConfiguredJetty;
@ -26,8 +26,8 @@ import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.toolchain.test.TestingDir; import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.webapp.WebAppContext; import org.eclipse.jetty.webapp.WebAppContext;
import org.junit.After; import org.junit.After;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -62,7 +62,7 @@ public class GlobalWebappConfigBindingTest
@Test @Test
public void testServerAndSystemClassesOverride() throws Exception public void testServerAndSystemClassesOverride() throws Exception
{ {
IO.copy(MavenTestingUtils.getTestResourceFile("context-binding-test-1.xml"), new File(jetty.getJettyHome(), "context-binding-test-1.xml")); IO.copy(MavenTestingUtils.getTestResourceFile("context-binding-test-1.xml"),new File(jetty.getJettyHome(),"context-binding-test-1.xml"));
jetty.addConfiguration("binding-test-contexts-1.xml"); jetty.addConfiguration("binding-test-contexts-1.xml");
jetty.load(); jetty.load();
@ -70,36 +70,26 @@ public class GlobalWebappConfigBindingTest
WebAppContext context = jetty.getWebAppContexts().get(0); WebAppContext context = jetty.getWebAppContexts().get(0);
Assert.assertNotNull(context); Assert.assertNotNull("Context should not be null",context);
Assert.assertEquals(context.getDefaultServerClasses().length, context.getServerClasses().length - 1); // added a pattern String defaultClasses[] = context.getDefaultServerClasses();
//Assert.assertEquals(context.getDefaultSystemClasses().length,context.getSystemClasses().length + 1); // removed a patter String currentClasses[] = context.getServerClasses();
boolean fooPackage = false; String addedClass = "org.eclipse.foo."; // What was added by the binding
Assert.assertThat("Default Server Classes",addedClass,not(isIn(defaultClasses)));
// we are inserting the foo package into the server classes Assert.assertThat("Current Server Classes",addedClass,isIn(currentClasses));
for (String entry : context.getServerClasses())
{
if ("org.eclipse.foo.".equals(entry))
{
fooPackage = true;
}
}
Assert.assertTrue(fooPackage);
// boolean jndiPackage = false; // boolean jndiPackage = false;
// this test overrides and we removed the jndi from the list so it // this test overrides and we removed the jndi from the list so it
// should test false // should test false
// for (String entry : context.getSystemClasses()) // for (String entry : context.getSystemClasses())
// { // {
// if ("org.eclipse.jetty.jndi.".equals(entry)) // if ("org.eclipse.jetty.jndi.".equals(entry))
// { // {
// jndiPackage = true; // jndiPackage = true;
// } // }
// } // }
// //
// Assert.assertFalse(jndiPackage); // Assert.assertFalse(jndiPackage);
} }
} }