import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.BeforeEach; import java.util.Arrays; public class SimpleTest { private ChocolateConsumerPair consumer; @BeforeEach public void init() { consumer = new DarkChocolateConsumerPair(); } @Test public void test1() { test(new int[]{ 2, 9, 8, 2, 7 }, 2); } @Test public void test2() { test(new int[]{ 1, 2, 3, 4, 3, 2, 1 }, 4); } private void test(int[] input, int expected){ Assertions.assertEquals(expected, consumer.consume(input), "Input: " + Arrays.toString(input)); } }