本文整理汇总了Java中com.meterware.httpunit.WebResponse.getApplets方法的典型用法代码示例。如果您正苦于以下问题:Java WebResponse.getApplets方法的具体用法?Java WebResponse.getApplets怎么用?Java WebResponse.getApplets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.meterware.httpunit.WebResponse
的用法示例。
在下文中一共展示了WebResponse.getApplets方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindApplets
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testFindApplets() throws Exception {
defineWebPage( "start", "<applet code='FirstApplet.class' width=150 height=100></applet>" +
"<applet code='SecondApplet.class' width=150 height=100></applet>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet[] applets = response.getApplets();
assertNotNull( "No applet found", applets );
assertEquals( "number of applets in page", 2, applets.length );
}
示例2: testAppletProperties
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testAppletProperties() throws Exception {
defineWebPage( "start", "<applet code='FirstApplet.class' name=first codebase='/classes' width=150 height=100></applet>" +
"<applet code='SecondApplet.class' name=second width=150 height=100></applet>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet applet1 = response.getApplets()[0];
WebApplet applet2 = response.getApplets()[1];
assertEquals( "Applet 1 codebase", getHostPath() + "/classes/", applet1.getCodeBaseURL().toExternalForm() );
assertEquals( "Applet 2 codebase", getHostPath() + "/", applet2.getCodeBaseURL().toExternalForm() );
assertEquals( "Applet 1 name", "first", applet1.getName() );
assertEquals( "Applet 1 width", 150, applet1.getWidth() );
assertEquals( "Applet 1 height", 100, applet1.getHeight() );
}
示例3: testReadAppletParameters
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testReadAppletParameters() throws Exception {
defineWebPage( "start", "<applet code='DoIt'>" +
" <param name='color' value='ffff00'>" +
" <param name='age' value='12'>" +
"</applet>" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet applet = response.getApplets()[0];
assertNotNull( "Parameter names return null", applet.getParameterNames() );
assertEquals( "Number of parameters", 2, applet.getParameterNames().length );
assertMatchingSet( "Parameter names", new String[]{"color", "age"}, applet.getParameterNames() );
}
示例4: testAppletLoading
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testAppletLoading() throws Exception {
defineWebPage( "start", "<applet code='" + SimpleApplet.class.getName() +
".class' codebase=/classes width=100 height=100></applet>");
mapToClasspath( "/classes" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet wa = response.getApplets()[0];
Applet applet = wa.getApplet();
assertNotNull( "Applet was not loaded", applet );
assertEquals( "Applet class", SimpleApplet.class.getName(), applet.getClass().getName() );
}
示例5: testShowDocument
import com.meterware.httpunit.WebResponse; //导入方法依赖的package包/类
public void testShowDocument() throws Exception {
defineResource( "next.html", "You made it!" );
defineWebPage( "start", "<applet code='" + SimpleApplet.class.getName() +
".class' codebase=/classes width=100 height=100></applet>");
mapToClasspath( "/classes" );
WebConversation wc = new WebConversation();
WebResponse response = wc.getResponse( getHostPath() + "/start.html" );
WebApplet wa = response.getApplets()[0];
Applet applet = wa.getApplet();
applet.getAppletContext().showDocument( new URL( getHostPath() + "/next.html" ) );
assertEquals( "current page URL", getHostPath() + "/next.html", wc.getCurrentPage().getURL().toExternalForm() );
}