inventory #14

Merged
erns6604 merged 11 commits from inventory into main 2025-10-29 14:21:29 +01:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit b0614649d2 - Show all commits

View File

@@ -33,4 +33,5 @@ public class InventoryTest {
)
));
}
}

View File

@@ -7,7 +7,9 @@ import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class MinerTest {
private Player defaultPlayer() {return new Player("John"); }
@@ -41,7 +43,8 @@ public class MinerTest {
}
@Test
void dig_in_coast_use_coast_loot() {
RandomProvider random = bound -> 9;
RandomProvider random = mock(RandomProvider.class);
when(random.nextInt(anyInt())).thenReturn(9);
var job = new Miner(defaultPlayer());
Biome.COAST.getLootTable().setRandomProvider(random);
job.dig(Biome.COAST);
@@ -51,7 +54,8 @@ public class MinerTest {
@Test
void dig_in_mountain_use_mountain_loot() {
RandomProvider random = bound -> 15;
RandomProvider random = mock(RandomProvider.class);
when(random.nextInt(anyInt())).thenReturn(15);
var job = new Miner(defaultPlayer());
Biome.MOUNTAIN.getLootTable().setRandomProvider(random);
job.dig(Biome.MOUNTAIN);