package de.kimminich.kata.tcg.strategy;

import org.junit.Test;

import java.util.OptionalInt;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class SmartStrategyTest {

    Strategy strategy;

    @Test
    public void smartStrategyShouldPlayCardsToMaximizeCombinedDamage() {
        strategy = new SmartStrategy();

        assertThat(strategy.nextCard(10, new int[]{2, 2, 3, 8, 9}), is(card(8)));
        assertThat(strategy.nextCard(2, new int[]{2, 2, 3, 9}), is(card(2)));

        assertThat(strategy.nextCard(10, new int[]{1, 2, 2, 3, 8, 9}), is(card(9)));
        assertThat(strategy.nextCard(1, new int[]{1, 2, 2, 3, 8}), is(card(1)));

        assertThat(strategy.nextCard(10, new int[]{2, 3, 4, 5}), is(card(5)));
        assertThat(strategy.nextCard(5, new int[]{2, 3, 4}), is(card(3)));
        assertThat(strategy.nextCard(2, new int[]{2, 4}), is(card(2)));
    }

    @Test
    public void strategyShouldReturnNoCardIfInsufficientManaForAnyHandCard() {
        strategy = new SmartStrategy();

        assertThat(strategy.nextCard(1, new int[]{2, 3, 8}), is(noCard()));
    }

    private OptionalInt card(int card) {
        return OptionalInt.of(card);
    }

    private OptionalInt noCard() {
        return OptionalInt.empty();
    }
}

@@ -294,19 +294,8 @@
 ould
-PlayCardsTo
 Maxi
@@ -312,16 +312,22 @@
 edDamage
+Output
 () %7B%0A   
@@ -417,27 +417,24 @@
 int%5B%5D%7B2,
- 2,
  3, 
-8, 9
+4, 5
 %7D), is(c
@@ -437,17 +437,17 @@
 is(card(
-8
+5
 )));%0A   
@@ -472,33 +472,33 @@
 rategy.nextCard(
-2
+5
 , new int%5B%5D%7B2, 2
@@ -499,16 +499,13 @@
 %5D%7B2,
- 2,
  3, 
-9
+4
 %7D), 
@@ -516,15 +516,14 @@
 ard(
-2
+3
 )));%0A
-%0A
     
@@ -547,34 +547,33 @@
 rategy.nextCard(
-10
+2
 , new int%5B%5D%7B1, 2
@@ -572,24 +572,12 @@
 t%5B%5D%7B
-1, 2, 2, 3, 8, 9
+2, 4
 %7D), 
@@ -588,9 +588,9 @@
 ard(
-9
+2
 )));
@@ -598,165 +598,142 @@
     
+%7D%0A%0A
     
-assertThat(strategy.nextCard(1, new int%5B%5D%7B1, 2, 2, 3, 8%7D), is(card(1)));%0A%0A        assertThat(strategy.nextCard(10, new int%5B%5D%7B2, 3, 4, 5%7D), is(card(5))
+@Test%0A    public void smartStrategyShouldFavorCombinedDamageOutputOverHighestCard() %7B%0A        strategy = new SmartStrategy(
 );%0A
+%0A
     
@@ -757,33 +757,34 @@
 rategy.nextCard(
-5
+10
 , new int%5B%5D%7B2, 3
@@ -774,36 +774,42 @@
 0, new int%5B%5D%7B2, 
-3, 4
+2, 3, 8, 9
 %7D), is(card(3)))
@@ -796,33 +796,33 @@
 8, 9%7D), is(card(
-3
+8
 )));%0A        ass
@@ -855,33 +855,39 @@
 2, new int%5B%5D%7B2, 
-4
+2, 3, 9
 %7D), is(card(2)))
@@ -880,32 +880,33 @@
 , is(card(2)));%0A
+%0A
     %7D%0A%0A    @Test

split up tests