com.mockrunner.test.gen.MockrunnerJarsTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Mockrunner is a lightweight framework for unit testing applications
in the J2EE environment. It supports servlets, filters, tag classes
and Struts actions. It includes a JDBC a JMS and a JCA test
framework and can be used to test EJB based applications.
The newest version!
package com.mockrunner.test.gen;
import java.util.HashSet;
import java.util.Set;
import com.mockrunner.gen.jar.MockrunnerJars.Permission;
import junit.framework.TestCase;
public class MockrunnerJarsTest extends TestCase
{
private Set getTestDependencies()
{
Set dependencies = new HashSet();
dependencies.add("struts-core-1.3.8.jar");
dependencies.add("servlet-api.jar");
dependencies.add("jboss-j2ee.jar");
dependencies.add("nekohtml.jar");
dependencies.add("xercesImpl.jar");
dependencies.add("xyz.jar");
return dependencies;
}
public void testPermission()
{
Permission permission = new Permission(false, true, true, false, true);
Set prohibited = permission.getProhibited(getTestDependencies());
assertEquals(1, prohibited.size());
assertTrue(prohibited.contains("struts-core-1.3.8.jar"));
permission = new Permission(false, true, true, false, false);
prohibited = permission.getProhibited(getTestDependencies());
assertEquals(3, prohibited.size());
assertTrue(prohibited.contains("struts-core-1.3.8.jar"));
assertTrue(prohibited.contains("nekohtml.jar"));
assertTrue(prohibited.contains("xercesImpl.jar"));
permission = new Permission(false, false, true, false, false);
prohibited = permission.getProhibited(getTestDependencies());
assertEquals(4, prohibited.size());
assertTrue(prohibited.contains("struts-core-1.3.8.jar"));
assertTrue(prohibited.contains("servlet-api.jar"));
assertTrue(prohibited.contains("nekohtml.jar"));
assertTrue(prohibited.contains("xercesImpl.jar"));
permission = new Permission(false, false, false, false, false);
prohibited = permission.getProhibited(getTestDependencies());
assertEquals(5, prohibited.size());
assertFalse(prohibited.contains("xyz.jar"));
permission = new Permission(true, true, true, true, true);
prohibited = permission.getProhibited(getTestDependencies());
assertTrue(prohibited.isEmpty());
}
}