当前位置:   article > 正文

java 如何写测试类_(五)如何写测试类

java测试类怎么写

/*** A demostration of the class ArrayBag

*@authorAdministrator

**/

public classArrayBagDemo {public static voidmain(String[] args) {

String[] contentsOfBag= {"A", "A", "B", "A", "C", "A"};//Tests on an empty bag

BagInterface aBag = new ArrayBag<>(contentsOfBag.length);

System.out.println("Testing an initially empty bag:");

testIsEmpty(aBag,true);

String[] testStrings1= {"", "B"};

testFrequency(aBag, testStrings1);

testContains(aBag, testStrings1);

testRemove(aBag, testStrings1);//Adding strings

System.out.println("Adding " + contentsOfBag.length + " strings to an initially empty bag "

+ "with the capacity to hold more than " + contentsOfBag.length + " strings:");

testAdd(aBag

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号