需要帮助决定需要采取什么方法来测试下面的代码
我有一个叫做的方法
private messageDAOInf messageDAO;
public Response verifyUser(Request request) {
Response response = null;
if (someCondition) {
/* -----------Some processing here---------- */
} else {
response = constructResponse(errorCode, errorDesc);
}
// Do more processing with messages from response
response = messageDAOInf
.convertMessagesAsAppropriate(response);
return response;
}
Run Code Online (Sandbox Code Playgroud)
我的EasyMock代码就在这里
/** The message dao inf. */
private MessageDAOInf messageDAOInf;
private VerifyUserService verifyUserServiceI;
@Before
public void setUp() throws Exception {
messageDAOInf = EasyMock.createMock(MessageDAOInf.class);
verifyUserService = new VerifyUserService();
verifyUserService.setMessageDAOInf(messageDAOInf);
}
@Test
public void testErrorResponse() {
Request …Run Code Online (Sandbox Code Playgroud) 当用户点击按钮时,我需要在String java中生成随机字符.例如:如果我们采用cat示例,我需要在字符串中显示字符,如下所示:
CAT,ACT,TAC,TCA
提前致谢
阿斯旺
我有这个
A
/ \
B C
\ /
D
Run Code Online (Sandbox Code Playgroud)
A具有纯虚函数,原型如下:
virtual A* clone(void) const = 0;
Run Code Online (Sandbox Code Playgroud)
B和C几乎继承自A(class B: public virtual A,class C: public virtual A)
B具有虚函数,原型为:
virtual B* clone(void) const {};
Run Code Online (Sandbox Code Playgroud)
C具有虚函数,原型为:
virtual C* clone(void) const {};
Run Code Online (Sandbox Code Playgroud)
D继承了B&C,如:class D: public B, public C
D具有虚函数,原型为:
virtual D* clone(void) const {};
Run Code Online (Sandbox Code Playgroud)
现在,在编译时我得到以下6行错误:
error C2250: 'D' : ambiguous inheritance of 'B *A::clone(void) const'
Run Code Online (Sandbox Code Playgroud)
毫无疑问如何解决这个问题.
提前致谢.