How to write a Unit Test?

后端 未结 5 1954
面向向阳花
面向向阳花 2020-11-22 07:39

I have a Java class. How can I unit test it?


In my case, I have class does a binary sum. It takes two byte[] arrays, sums them, and returns a new

5条回答
  •  不思量自难忘°
    2020-11-22 08:11

    Like @CoolBeans mentioned, take a look at jUnit. Here is a short tutorial to get you started as well with jUnit 4.x

    Finally, if you really want to learn more about testing and test-driven development (TDD) I recommend you take a look at the following book by Kent Beck: Test-Driven Development By Example.

提交回复
热议问题