Quantcast
Channel: Dark Views » TDD
Viewing all articles
Browse latest Browse all 10

Testing the Impossible: Asserting Several Values At Once

$
0
0

So you want to check several values at once, maybe because that helps you to locate the error more easily. Simple:

int v1 = list1.size();
int v2 = list2.size();
int v3 = list3.size();

assertEquals (
      "list1=5\n"
    + "list2=2\n"
    + "list3=0\n"
    , "list1="+v1+"\n"
    + "list2="+v2+"\n"
    + "list3="+v3+"\n"

Tagged: TDD, Testing

Viewing all articles
Browse latest Browse all 10

Trending Articles