Skip to content

Commit 242f3ce

Browse files
authored
fix deprecation warnings in tests (#2744)
1 parent 7a595aa commit 242f3ce

File tree

5 files changed

+205
-252
lines changed

5 files changed

+205
-252
lines changed

src/test/java/gregtech/api/capability/impl/AbstractRecipeLogicTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import gregtech.api.metatileentity.SimpleMachineMetaTileEntity;
77
import gregtech.api.recipes.Recipe;
88
import gregtech.api.recipes.RecipeMap;
9+
import gregtech.api.recipes.RecipeMapBuilder;
910
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
1011
import gregtech.api.util.GTUtility;
1112
import gregtech.api.util.world.DummyWorld;
@@ -116,13 +117,13 @@ private static AbstractRecipeLogic createTestLogic(int testRecipeEUt, int testRe
116117
World world = DummyWorld.INSTANCE;
117118

118119
// Create an empty recipe map to work with
119-
RecipeMap<SimpleRecipeBuilder> map = new RecipeMap<>("test_reactor_" + TEST_ID,
120-
2,
121-
2,
122-
3,
123-
2,
124-
new SimpleRecipeBuilder().EUt(30),
125-
false);
120+
RecipeMap<SimpleRecipeBuilder> map = new RecipeMapBuilder<>("test_reactor_" + TEST_ID,
121+
new SimpleRecipeBuilder().EUt(30))
122+
.itemInputs(2)
123+
.itemOutputs(2)
124+
.fluidInputs(3)
125+
.fluidOutputs(2)
126+
.build();
126127

127128
MetaTileEntity at = MetaTileEntities.registerMetaTileEntity(TEST_ID,
128129
new SimpleMachineMetaTileEntity(

src/test/java/gregtech/api/capability/impl/MultiblockRecipeLogicTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
import gregtech.api.metatileentity.multiblock.MultiblockControllerBase;
99
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
1010
import gregtech.api.recipes.Recipe;
11-
import gregtech.api.recipes.RecipeMap;
1211
import gregtech.api.recipes.RecipeMaps;
13-
import gregtech.api.recipes.builders.BlastRecipeBuilder;
1412
import gregtech.api.util.world.DummyWorld;
1513
import gregtech.common.metatileentities.MetaTileEntities;
1614
import gregtech.common.metatileentities.multi.electric.MetaTileEntityElectricBlastFurnace;
@@ -50,15 +48,6 @@ public static void bootstrap() {
5048
public void trySearchNewRecipe() {
5149
World world = DummyWorld.INSTANCE;
5250

53-
// Create a recipe Map to be used for testing
54-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("test_recipemap",
55-
3,
56-
3,
57-
1,
58-
1,
59-
new BlastRecipeBuilder().EUt(32),
60-
false);
61-
6251
RecipeMaps.BLAST_RECIPES.recipeBuilder()
6352
.inputs(new ItemStack(Blocks.COBBLESTONE))
6453
.outputs(new ItemStack(Blocks.STONE))
@@ -285,15 +274,6 @@ protected IMultipleTankHandler getOutputTank() {
285274
public void trySearchNewRecipeDistinct() {
286275
World world = DummyWorld.INSTANCE;
287276

288-
// Create a recipe Map to be used for testing
289-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("test_recipemap_2",
290-
3,
291-
3,
292-
1,
293-
1,
294-
new BlastRecipeBuilder().EUt(32),
295-
false);
296-
297277
RecipeMaps.BLAST_RECIPES.recipeBuilder()
298278
.inputs(new ItemStack(Blocks.COBBLESTONE))
299279
.outputs(new ItemStack(Blocks.STONE))

src/test/java/gregtech/api/recipes/RecipeMapTest.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,12 @@ public static void bootstrap() {
4040

4141
@BeforeEach
4242
public void setupRecipes() {
43-
map = new RecipeMap<>("test_reactor_" + mapId++,
44-
2,
45-
2,
46-
3,
47-
2,
48-
new SimpleRecipeBuilder().EUt(30),
49-
false);
43+
map = new RecipeMapBuilder<>("test_reactor_" + mapId++, new SimpleRecipeBuilder().EUt(30))
44+
.itemInputs(2)
45+
.itemOutputs(2)
46+
.fluidInputs(3)
47+
.fluidOutputs(2)
48+
.build();
5049

5150
map.recipeBuilder()
5251
.notConsumable(new ItemStack(Blocks.COBBLESTONE))
@@ -257,7 +256,10 @@ public void MapHashCollision() {
257256
@Test
258257
public void wildcardInput() {
259258
// test that all variants of a wildcard input can be used to find a recipe
260-
RecipeMap<?> recipeMap = new RecipeMap<>("test", 1, 4, 0, 0, new SimpleRecipeBuilder(), false);
259+
RecipeMap<?> recipeMap = new RecipeMapBuilder<>("test", new SimpleRecipeBuilder())
260+
.itemInputs(1)
261+
.itemOutputs(4)
262+
.build();
261263
recipeMap.recipeBuilder()
262264
.inputs(new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, GTValues.W))
263265
.outputs(new ItemStack(Blocks.COBBLESTONE, 1))

src/test/java/gregtech/api/recipes/logic/IParallelableRecipeLogicTest.java

Lines changed: 60 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,12 @@ public void findMultipliedRecipe_AtMaxParallelsTest() {
208208
int parallelLimit = 4;
209209

210210
// Create a recipe Map to be used for testing
211-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
212-
3,
213-
2,
214-
1,
215-
1,
216-
new BlastRecipeBuilder(),
217-
false);
211+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
212+
.itemInputs(3)
213+
.itemOutputs(2)
214+
.fluidInputs(1)
215+
.fluidOutputs(1)
216+
.build();
218217

219218
// Create a simple recipe to be used for testing
220219
Recipe recipe = map.recipeBuilder()
@@ -261,13 +260,12 @@ public void findMultipliedRecipe_LessThanMaxParallelsTest() {
261260
int parallelLimit = 4;
262261

263262
// Create a recipe Map to be used for testing
264-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
265-
3,
266-
2,
267-
1,
268-
1,
269-
new BlastRecipeBuilder(),
270-
false);
263+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
264+
.itemInputs(3)
265+
.itemOutputs(2)
266+
.fluidInputs(1)
267+
.fluidOutputs(1)
268+
.build();
271269

272270
// Create a simple recipe to be used for testing
273271
Recipe recipe = map.recipeBuilder()
@@ -313,13 +311,12 @@ public void findMultipliedRecipe_FluidOnlyMaxParallelTest() {
313311
int parallelLimit = 4;
314312

315313
// Create a recipe Map to be used for testing
316-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
317-
3,
318-
2,
319-
1,
320-
1,
321-
new BlastRecipeBuilder(),
322-
false);
314+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
315+
.itemInputs(3)
316+
.itemOutputs(2)
317+
.fluidInputs(1)
318+
.fluidOutputs(1)
319+
.build();
323320

324321
// Create a simple recipe to be used for testing
325322
Recipe recipe = map.recipeBuilder()
@@ -366,13 +363,12 @@ public void findMultipliedRecipe_FluidOnlyLessThanMaxParallelTest() {
366363
int parallelLimit = 4;
367364

368365
// Create a recipe Map to be used for testing
369-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
370-
3,
371-
2,
372-
2,
373-
1,
374-
new BlastRecipeBuilder(),
375-
false);
366+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
367+
.itemInputs(3)
368+
.itemOutputs(2)
369+
.fluidInputs(1)
370+
.fluidOutputs(1)
371+
.build();
376372

377373
// Create a simple recipe to be used for testing
378374
Recipe recipe = map.recipeBuilder()
@@ -419,13 +415,12 @@ public void findAppendedParallelItemRecipe_AtMaxParallelsTest() {
419415
int parallelLimit = 4;
420416

421417
// Create a recipe Map to be used for testing
422-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("test_blast_furnace",
423-
3,
424-
2,
425-
1,
426-
1,
427-
new BlastRecipeBuilder(),
428-
false);
418+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("test_blast_furnace", new BlastRecipeBuilder())
419+
.itemInputs(3)
420+
.itemOutputs(2)
421+
.fluidInputs(1)
422+
.fluidOutputs(1)
423+
.build();
429424

430425
// Create a simple recipe to be used for testing
431426
map.recipeBuilder()
@@ -466,13 +461,12 @@ public void findAppendedParallelItemRecipe_LessThanMaxParallelsTest() {
466461
int parallelLimit = 4;
467462

468463
// Create a recipe Map to be used for testing
469-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("test_blast_furnace_2",
470-
3,
471-
2,
472-
1,
473-
1,
474-
new BlastRecipeBuilder(),
475-
false);
464+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("test_blast_furnace_2", new BlastRecipeBuilder())
465+
.itemInputs(3)
466+
.itemOutputs(2)
467+
.fluidInputs(1)
468+
.fluidOutputs(1)
469+
.build();
476470

477471
// Create a simple recipe to be used for testing
478472
map.recipeBuilder()
@@ -543,13 +537,12 @@ public MetaTileEntity getMetaTileEntity() {
543537
};
544538

545539
// Create a recipe Map to be used for testing
546-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
547-
3,
548-
2,
549-
1,
550-
1,
551-
new BlastRecipeBuilder(),
552-
false);
540+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
541+
.itemInputs(3)
542+
.itemOutputs(2)
543+
.fluidInputs(1)
544+
.fluidOutputs(1)
545+
.build();
553546

554547
// Create a simple recipe to be used for testing
555548
Recipe recipe = map.recipeBuilder()
@@ -618,13 +611,12 @@ public MetaTileEntity getMetaTileEntity() {
618611
};
619612

620613
// Create a recipe Map to be used for testing
621-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
622-
3,
623-
2,
624-
1,
625-
1,
626-
new BlastRecipeBuilder(),
627-
false);
614+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
615+
.itemInputs(3)
616+
.itemOutputs(2)
617+
.fluidInputs(1)
618+
.fluidOutputs(1)
619+
.build();
628620

629621
// Create a simple recipe to be used for testing
630622
Recipe recipe = map.recipeBuilder()
@@ -683,13 +675,12 @@ public MetaTileEntity getMetaTileEntity() {
683675
};
684676

685677
// Create a recipe Map to be used for testing
686-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
687-
3,
688-
2,
689-
1,
690-
1,
691-
new BlastRecipeBuilder(),
692-
false);
678+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
679+
.itemInputs(3)
680+
.itemOutputs(2)
681+
.fluidInputs(1)
682+
.fluidOutputs(1)
683+
.build();
693684

694685
// Create a simple recipe to be used for testing
695686
Recipe recipe = map.recipeBuilder()
@@ -788,13 +779,12 @@ public MetaTileEntity getMetaTileEntity() {
788779
};
789780

790781
// Create a recipe Map to be used for testing
791-
RecipeMap<BlastRecipeBuilder> map = new RecipeMap<>("electric_blast_furnace",
792-
3,
793-
2,
794-
1,
795-
1,
796-
new BlastRecipeBuilder(),
797-
false);
782+
RecipeMap<BlastRecipeBuilder> map = new RecipeMapBuilder<>("electric_blast_furnace", new BlastRecipeBuilder())
783+
.itemInputs(3)
784+
.itemOutputs(2)
785+
.fluidInputs(1)
786+
.fluidOutputs(1)
787+
.build();
798788

799789
// Create a simple recipe to be used for testing
800790
Recipe recipe = map.recipeBuilder()

0 commit comments

Comments
 (0)