|
| 1 | +package jwarrior.juego.puntuacion; |
| 2 | + |
| 3 | +import static org.hamcrest.CoreMatchers.is; |
| 4 | +import static org.junit.Assert.assertThat; |
| 5 | +import jwarrior.piezas.unidades.Orco; |
| 6 | +import jwarrior.piezas.unidades.Unidad; |
| 7 | +import jwarrior.piezas.unidades.mocks.UnidadStubBuilder; |
| 8 | + |
| 9 | +import org.junit.Test; |
| 10 | + |
| 11 | +public class PuntajeTests { |
| 12 | + |
| 13 | + @Test |
| 14 | + public void alIniciarPuntajeComienzaConValorInicial() { |
| 15 | + |
| 16 | + Puntaje puntaje = new Puntaje(); |
| 17 | + assertThat(puntaje.obtenerPuntaje(), is(10)); |
| 18 | + } |
| 19 | + |
| 20 | + @Test |
| 21 | + public void alInformarPasoDeTurnoRestaPuntaje() { |
| 22 | + |
| 23 | + Puntaje puntaje = new Puntaje(); |
| 24 | + puntaje.notificarTurno(); |
| 25 | + assertThat(puntaje.obtenerPuntaje(), is(9)); |
| 26 | + } |
| 27 | + |
| 28 | + @Test |
| 29 | + public void alInformarMuerteEnemigoSumaSaludMaximaEnemigo() { |
| 30 | + |
| 31 | + Puntaje puntaje = new Puntaje(); |
| 32 | + puntaje.notificarMuerteEnemigo(new Orco()); |
| 33 | + assertThat(puntaje.obtenerPuntaje(), is(18)); |
| 34 | + } |
| 35 | + |
| 36 | + @Test |
| 37 | + public void alInformarFinalizacionPartidaSumaMitadDeSalud() { |
| 38 | + |
| 39 | + Puntaje puntaje = new Puntaje(); |
| 40 | + puntaje.notificarFinalizacionPartida(UnidadStubBuilder.construirStubGuerrero()); |
| 41 | + assertThat(puntaje.obtenerPuntaje(), is(20)); |
| 42 | + } |
| 43 | + |
| 44 | + @Test |
| 45 | + public void alInformarFinalizacionPartidaHeridoSumaMitadDeSalud() { |
| 46 | + Puntaje puntaje = new Puntaje(); |
| 47 | + Unidad guerrero = UnidadStubBuilder.construirStubGuerrero(); |
| 48 | + guerrero.recibirGolpe(4); |
| 49 | + |
| 50 | + puntaje.notificarFinalizacionPartida(guerrero); |
| 51 | + assertThat(puntaje.obtenerPuntaje(), is(18)); |
| 52 | + } |
| 53 | +} |
0 commit comments