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?@Testpublic 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?
Is a unit test using setup code an integration test?
unit testing;integration tests
First, there is no strict, widely accepted definition of when a test is not a unit test any more - the boundaries are blurry and to some degree opiniated.However, my understanding of the word integration tests involves that there must be at least two units or components of code, and some production code which integrates them. An integration test then is a piece of code which checks that integrated scenario of the production code, not some integrational setup in test code.