I'm using Mockito for unit testing, and as such, it looks like i'm able to inject certain objects using the @InjectMocks
and @Mock
annotations. I'm assuming i can do this for Object type Boolean
s
However, i can't seem to get this to work for primitive boolean
s. How do i do this? or what frameworks allow this? (i'm actually on an Android project)
for example:
class MethCook {
private Laboratory mLab; // i can inject this
private Assistant mJessePinkman; // this is injectable too
private boolean mCanCookPureCrystal; // how do i access/inject this?
private void cookBlueMeth() { ... }
private void onTraumatized() {
mCanCookPureCrystal = false;
startMoppingAround();
beDepressed();
neverWantToCookAgain();
}
}
note: elegance meaning brevity and conciseness, as in... i would prefer not to use @VisibleForTesting
on top of getter/setters to access this boolean; as that would expose state mutability to the outside world?