Skip to content

Commit

Permalink
Merge pull request #3853 from Sleet01/Fix_some_mekhq_refit_tests
Browse files Browse the repository at this point in the history
Partial fix for failing refit tests
  • Loading branch information
HammerGS authored Feb 24, 2024
2 parents 9f60ccf + e3585e2 commit 439e707
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions MekHQ/unittests/mekhq/campaign/parts/RefitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import mekhq.campaign.personnel.Person;
import mekhq.campaign.unit.Unit;
import mekhq.campaign.unit.UnitTestUtilities;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down Expand Up @@ -77,6 +78,11 @@ public class RefitTest {
@Mock
private Warehouse mockWarehouse;

@BeforeAll
static void before() {
EquipmentType.initializeTypes();
}

@BeforeEach
public void beforeEach() {
lenient().when(mockCampaign.getCampaignOptions()).thenReturn(mockCampaignOptions);
Expand Down Expand Up @@ -157,7 +163,7 @@ public void locust1Vto1ETest() {
// Locust 1V to 1E Class D refit steps (in no particular order):
// 1. Remove excess Machine Gun (LA) [120 mins]
// 2. Remove excess Machine Gun (RA) [120 mins]
// 3. Remove Machine Gun Ammo Bin (CT) [120 mins]
// 3. Remove Machine Gun Ammo [Full] Bin (CT) [120 mins]
// 4. Move Medium Laser (CT) to (RA) [120 mins]
// 5. Add Medium Laser to (LA) [120 mins]
// 6. Add Small Laser to (RA) [120 mins]
Expand Down Expand Up @@ -191,7 +197,7 @@ public void locust1Vto1ETest() {
.filter(p -> (p instanceof EquipmentPart) && p.getName().equals("Machine Gun"))
.count());
assertEquals(1, removedParts.stream()
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin"))
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin"))
.count());

// All of the new parts should be from the old unit
Expand Down Expand Up @@ -540,7 +546,7 @@ public void fleaFLE4toFLE15Test() {
// 5. Add Medium Laser (RA) [120 mins]
// 6. Add Machine Gun (LA) [120 mins]
// 7. Add Machine Gun (RA) [120 mins]
// 8. Add Machine Gun Ammo Bin to (CT) [120 mins]
// 8. Add Machine Gun Ammo [Full] Bin to (CT) [120 mins]
// 9. Add 16 points of armor to 10 locations (except the HD).
// a. Add 1 point to (LA) [5 mins]
// b. Add 1 point to (RA) [5 mins]
Expand Down Expand Up @@ -601,7 +607,7 @@ public void fleaFLE4toFLE15Test() {
.filter(p -> (p instanceof MissingEquipmentPart) && p.getName().equals("Machine Gun"))
.count());
assertEquals(1, shoppingCart.stream()
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin"))
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin"))
.count());

// We should have 16 points of standard armor on order
Expand Down Expand Up @@ -767,7 +773,7 @@ public void heavyTrackedApcMgToStandard() throws EntityLoadingException, IOExcep
.filter(p -> (p instanceof EquipmentPart) && p.getName().equals("Machine Gun"))
.count());
assertEquals(1, removedParts.stream()
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo Bin"))
.filter(p -> (p instanceof AmmoBin) && p.getName().equals("Machine Gun Ammo [Full] Bin"))
.count());

// All of the new parts (except ammo bins) should be from the old unit
Expand Down

0 comments on commit 439e707

Please sign in to comment.