Sorry for the necro in this post, but I feel compelled to weigh a couple of things that did not seem to be affected.
First of all, when we need access to private class members during unit testing, this is usually a large, thick red flag that we used in a strategic or tactical approach and inadvertently violated common responsibility mainly by pushing behavior when it is not belongs. Awareness of the need for access to methods that are actually nothing more than an isolated routine of the build procedure is one of the most common cases of this; however, it looks like your boss expects you to go to work getting ready for work, as well as with some perverse need to find out what morning routine you went through to get you into this state ...
The other most common case of this event is when you try to test the notorious "class of gods." This is a special problem in itself, but it suffers from the same main problem, when it needs to know the intimate details of the procedure, but this leaves the topic.
In this particular example, we effectively instructed to fully initialize the Bar object for the constructor of the FooBar class. In object-oriented programming, one of the main factors is that the constructor is "sacred" and must be protected from invalid data, which would deprive its own internal state and leave it loaded to fail elsewhere down (in what may be very deep pipeline.)
We could not do this here by allowing the FooBar object to accept a Bar, which is not ready at the time the FooBar was constructed, and received compensation by “hacking” the FooBar object with its own hands.
This is the result of refusing to join object-oriented programming (in the case of Bar) to another object, which means that the state of the object must be fully initialized and ready to immediately make any incoming calls to its "public users" after creation. Now this does not mean immediately after calling the constructor in all instances. When you have an object with many complex construction scenarios, it is best to expose the setters to their optional members, an object that is implemented in accordance with the creation design pattern (Factory, Builder, etc.). In any of the latter cases, you would click on the initialization of the target object to another graph of objects, the sole purpose of which is to direct traffic so that you get to the point where you have a valid copy of what you are requesting - and the product should not be considered " ready "until this creation object executes it.
In your example, the status property of Bar does not look like the correct state in which FooBar can accept it, so FooBar is doing something to fix this problem.
The second problem that I see is that it seems that you are trying to test your code, and not practice test-based development. This is definitely my own opinion at this point in time; but this type of testing is indeed an anti-pattern. What you end up doing is falling into the trap of realizing that you have problems with the underlying design that prevent your code from being checked after the fact, instead of writing the tests you need and then programming for the tests. In any case, you are faced with a problem, you should still have the same number of tests and lines of code, if you really achieved the implementation of SOLID. So - why try and reverse engineer your way into the code under test, when you can just solve this issue at the beginning of your development efforts?
If you did this, then you would understand much earlier that you would have to write some pretty bad code to test your design, and he would have the opportunity to rebuild your approach at an early stage, changing the behavior to implementations that are easy to verify .