Programming books usually preach to only test a single method in a unit test. This is supposed to keep the tests independent of each other and reduce the amount of work needed to rewrite the tests if a particular part of the system changes.
But what about calls to set up the object under test?
@Test
public void testMethod_someState_someExpectation() {
MyObject obj = new MyObject();
obj.setSomeStuff();
obj.doSomeStuffToGetIntoTheSpecifiedState();
Test.assertEqual(obj.testMethod(), someValue);
}
Most of my unit tests look like this, because my object under test might be in many different states when calling my testMethod() and i would like to test how it behaves. And i guess most of the object oriented code out there doesn't consist of pure functions.
Are these kinds of tests automatically considered Integration testing, or is this kind of setup normal for unit testing?