Skip to content
Advertisement

Tag: tdd

JUnit4 – Trying to make my constructor work with my unit tests

So as you will be able to see in the code, my class constructor asks the user for an input of the “initialValue” of their object. I then have a method “addToValue” which adds to that value. When trying to use JUnit4 to learn TDD it does not use the “initialValue” parameter to set the value of “value”, therefore it

Are 2 references to an object == to each other?

I have a method, move(xSteps, ySteps), which takes a point and moves it according to the parameters on the method by increasing or decreasing x and y. But when the xSteps and ySteps are both 0, I want to store the moved point (which didn’t actually move) in the same memory location as the original point since the x and

Checking the results of a Factory in a unit test

I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a unit test for the factory. All you get back is an interface to the object. What is the best way to test that the factory has worked correctly? I

Advertisement