Reputation: 167
I am new to jUnit and I am finding testing the small project I'm working on difficult. All the examples for jUnit testing seem to involve math, and what I wrote is a simple application that takes information via Scanner and creates various objects and stores them in an ArrayList. One of my thoughts was to test if the ArrayList was empty, but I obviously cannot access it from a separate class, but the standard seems to be to separate the test from the code. So I am not sure what to do?
Upvotes: 2
Views: 1889
Reputation: 140427
The typical well established practices are:
The real answer here: you should share pieces of your code with us, to receive really helpful feedback.
Upvotes: 1
Reputation: 10003
You could provide a protected accessor for the array so that it can be used by the unit tests (which should be in the same package).
Upvotes: 2