Test case:
Verify Instance Creation through Constructor DeviceBeanInfo is failed
Summary: Verify Instance Creation through Constructor DeviceBeanInfo is failed
Preconditions: No Preconditions .
Steps:Invoke constructor DeviceBeanInfo .
Expected Results:on invalid operation it should throw IntrospectionException The testing class:import java.awt.Image;
import java.beans.BeanDescriptor;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.MethodDescriptor;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;import org.ziptie.addressing.IPAddress;import com.alterpoint.aof.util.AofBeanInfo;
import com.alterpoint.aof.util.AofPropertyDescriptor;
import com.alterpoint.server.BootActiveStatus;
import com.alterpoint.server.plugin.compliance.status.ComplianceStatus;/**
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DeviceBeanInfo extends AofBeanInfo
{
protected BeanDescriptor bd = new BeanDescriptor(com.alterpoint.aof.objects.cm.Device.class); /** Constructor for the CardBeanInfo object */
public DeviceBeanInfo() throws java.beans.IntrospectionException
{
// setup bean descriptor in constructor.
BeanInfo info = Introspector.getBeanInfo(getBeanDescriptor().getBeanClass().getSuperclass());
String order = info.getBeanDescriptor().getValue("propertyorder") == null ? "" : (String) info.getBeanDescriptor().getValue("propertyorder");
PropertyDescriptor[] pd = getPropertyDescriptors();
for (int i = 0; i != pd.length; i++)
{
if (order.indexOf(pd[i].getName()) == -1)
{
order = order + (order.length() == 0 ? "" : ":") + pd[i].getName();
}
}
getBeanDescriptor().setValue("propertyorder", order);
} public BeanDescriptor getBeanDescriptor()
{
return this.bd;
}
}when i attempted to code the test-case, i found that only the block of code "Introspector.getBeanInfo(getBeanDescriptor().getBeanClass().getSuperclass());" would throw the excepted Exception. How do i finish the test case without changing the construtor's code?
解决方案 »
- Java一键搜索---根据关键字查找文本(附源代码)
- 寻求java视频教程
- 实现两个接口的问题 String ITalk.hello()和OutputStream IWrite.hello()
- linux,win下java 运行速度相差如此之大,高手指点
- 10行的小程序, 编译能通过,运行报异常。有的空的朋友帮忙看下
- 请高手解释一下byte[] 转化为int型
- 打印机设置错误会导致打印时程序崩溃!
- 求助!!关于一个函数库的通用控制函数的的写法问题!
- 各位java大侠能不能传授一点经验?
- VJ6.0K中哪有WFC Controls
- 打包成jar文件后的运行
- JButton 的 Border不画,但是鼠标移动到上面的焦点怎么显示啊?
我不知道你为什么要让构造方法一定要抛这样的异常。
如果一定要这么做的话,写下面的语句:
if(false){
String mess = "EXCETION";
throw new InstrospectionException(mess);
}
when i attempted to code the test-case, i found that only the block of code "Introspector.getBeanInfo(getBeanDescriptor().getBeanClass().getSuperclass());" would throw the excepted Exception. How do i finish the test case without changing the construtor's code?