我尝试写一个测试一样,使用JUnit一个给定的接口,而且不知道该怎么做:JUnit测试,而无需执行尚未
public interface ShortMessageService {
/**
* Creates a message. A message is related to a topic
* Creates a date for the message
* @throws IllegalArgumentException, if the message is longer then 255 characters.
* @throws IllegalArgumentException, if the message ist shorter then 10 characters.
* @throws IllegalArgumentException, if the user doesn't exist
* @throws IllegalArgumentException, if the topic doesn't exist
* @throws NullPointerException, if one argument is null.
* @param userName
* @param message
* @return ID of the new created message
*/
Long createMessage(String userName, String message, String topic);
[...]
}
我试图嘲弄后的界面我意识到它根本没有意义,所以我有点失落。也许有人可以给我一个我可以合作的好方法。我也听说过有关junit参数化测试,但我不确定这是否是我正在寻找的。
非常感谢!
这听起来像是我的测试用例的完美解决方案/模式,非常感谢! – chillyistkult
@ Chilly90 - 别忘了接受答案,如果您发表评论表明您认为有用,则可能会对其进行投票。 – EJK