aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/fr
diff options
context:
space:
mode:
authorAdam NAILI2018-01-11 20:07:28 +0100
committerAdam NAILI2018-01-11 20:07:28 +0100
commit1347f30afbed7ee9c149f77534f5e75fbe819b98 (patch)
tree92d68934e527a2a9b7faa91e048d0ccd0bd65da3 /src/test/java/fr
parente5f4426230fc485feac96fd5db6151faad24591d (diff)
downloadwallj-1347f30afbed7ee9c149f77534f5e75fbe819b98.tar.gz
Implementing BoardConverter and test failed
Diffstat (limited to 'src/test/java/fr')
-rw-r--r--src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java b/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java
index 1ed74d1..9574adf 100644
--- a/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java
+++ b/src/test/java/fr/umlv/java/wallj/board/BoardConverterTest.java
@@ -1,4 +1,48 @@
1package fr.umlv.java.wallj.board; 1package fr.umlv.java.wallj.board;
2 2
3public class BoardConverterTest { 3import fr.umlv.java.wallj.model.*;
4import org.jbox2d.common.Vec2;
5import org.junit.jupiter.api.Assertions;
6import org.junit.jupiter.api.Test;
7
8import java.util.ArrayList;
9import java.util.LinkedList;
10import java.util.List;
11
12/**
13 * @author Adam NAILI
14 */
15final class BoardConverterTest {
16
17 @Test
18 void testWorldToBoard(){
19 List<Block> blocks = new LinkedList<>();
20 Board.Builder builder = new Board.Builder(5,1);
21 TileVec2 t0 = TileVec2.of(0,0);
22 TileVec2 t1 = TileVec2.of(1,0);
23 TileVec2 t2 = TileVec2.of(2,0);
24 TileVec2 t3 = TileVec2.of(3,0);
25 TileVec2 t4 = TileVec2.of(4,0);
26
27 builder.setBlockTypeAt(t0,BlockType.WALL);
28 builder.setBlockTypeAt(t1,BlockType.BOMB);
29 builder.setBlockTypeAt(t2,BlockType.GARBAGE);
30 builder.setBlockTypeAt(t3,BlockType.ROBOT);
31 builder.setBlockTypeAt(t4,BlockType.TRASH);
32
33 Board certifiedBoard = builder.build();
34
35 blocks.add(BlockFactory.build(BlockType.WALL,t0));
36 blocks.add(BlockFactory.build(BlockType.BOMB,t1));
37 blocks.add(BlockFactory.build(BlockType.GARBAGE,t2));
38 blocks.add(BlockFactory.build(BlockType.ROBOT,t3));
39 blocks.add(BlockFactory.build(BlockType.TRASH,t4));
40
41 Board board = BoardConverter.worldToBoard(blocks);
42
43 Assertions.assertEquals(certifiedBoard,board);
44
45 }
46
4} 47}
48