add testcase

This commit is contained in:
wenshao
2012-08-26 13:13:39 +08:00
parent e662f3f109
commit 58742c2a0e
2 changed files with 77 additions and 0 deletions
@@ -0,0 +1,32 @@
package com.alibaba.druid.bvt.utils;
import junit.framework.TestCase;
import org.junit.Assert;
import org.springframework.mock.web.MockServletContext;
import com.alibaba.druid.util.DruidWebUtils;
public class DruidWebUtilsTest extends TestCase {
public void test_getContextPath_2_5() throws Exception {
new DruidWebUtils(); //
MockServletContext context = new MockServletContext() {
public int getMajorVersion() {
return 2;
}
public int getMinorVersion() {
return 4;
}
public String getContextPath() {
throw new NoSuchMethodError();
}
};
Assert.assertNull(DruidWebUtils.getContextPath(context));
}
}