-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix unit tests on Large Craft Bays #4059
Conversation
bayWeapons.add(weaponBay); | ||
bayWeapons.add(mounted); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In several cases, this was the problem - the weaponBay was being added as a weapon of itself, instead of mounted
which is the key equipment being tested.
ammoBin.setUnit(unit); | ||
|
||
// Set the bay as if we're in deserialization code | ||
ammoBin.setBay(bayNum); | ||
|
||
ammoBin.setUnit(unit); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unit has to be set before you add the bay number.
when(entity.getWeaponBayList()).thenReturn(weaponBays); | ||
when(entity.whichBay(equipmentNum)).thenReturn((WeaponMounted) weaponBay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this solution because entity.whichBay
should already work because it calls entity.getWeaponBayList
which is mocked in line 278. However, on the debugger, that method was returning null within the whichBay
function. I think its ok?
//bayWeapons.addElement(33); | ||
bayWeapons.add(weaponBay); | ||
bayWeapons.add(mounted); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what 33 was supposed to be as this equipment number is not used in this test and its supposed to be testing a weapon bay with only one weapon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works, it works.
It works! All green. I think some of this is correcting mistakes from my last PR plus a few other tests that were failing.