Browse Source

test: invalid bishop move upward

feat-figureMovement
Julius Dewender 3 years ago
parent
commit
5fc5761e06
  1. 15
      fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java
  2. 16
      fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java

15
fh.fd.ci.client/src/main/java/de/fd/fh/FigureBishop.java

@ -0,0 +1,15 @@
package de.fd.fh;
public class FigureBishop extends Figure
{
@Override
public boolean moveAllowed(int src, int dst, Figure[] field)
{
if ((dst-src) % 8 == 0) // nach oben/unten nicht erlaubt
{
return false;
}
return super.moveAllowed(src, dst, field);
}
}

16
fh.fd.ci.client/src/test/java/de/fd/fh/FigureBishopTest.java

@ -0,0 +1,16 @@
package de.fd.fh;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class FigureBishopTest
{
@Test
void checkInvalidMovesBishop()
{
Figure f = new FigureBishop();
assertFalse(f.moveAllowed(45, 37, new Figure[64]));
}
}
Loading…
Cancel
Save