Example: Hello World - ESAPI/esapi-java-legacy GitHub Wiki
Here is a "Hello World" using JUnit and ESAPI for Java's development test harness:
import org.owasp.esapi.ESAPI;
import org.owasp.esapi.Validator;
public class HelloWorldTest extends TestCase
{
public static Test suite()
{
return new TestSuite(HelloWorldTest.class);
}
public HelloWorldTest(String testName)
{
super(testName);
}
protected void setUp() throws Exception
{
// none
}
protected void tearDown() throws Exception
{
// none
}
public void testIsValidEmail()
{
Validator instance = ESAPI.validator();
assertTrue(instance.isValidInput("test", "[email protected]", "Email",
100,false));
}
}