-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added formatting rules description and applied to TileTest.java
- Loading branch information
Showing
2 changed files
with
49 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
package project_16x16.components; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.mockito.Mockito.mock; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import processing.core.PImage; | ||
import processing.core.PVector; | ||
import project_16x16.Tileset; | ||
import project_16x16.components.Tile; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class TileTest { | ||
|
||
private Tile tile; | ||
private PImage image; | ||
|
||
|
||
@BeforeEach | ||
void setup() { | ||
image = mock(PImage.class); | ||
tile = new Tile(1, "tile", image, Tile.TileType.BACKGROUND); | ||
} | ||
|
||
@Test | ||
void constructorTest() { | ||
assertNotNull(tile); | ||
} | ||
@Test | ||
void getIDTest() { | ||
assertEquals(tile.getId(), 1); | ||
} | ||
@Test | ||
void getNameTest() { | ||
assertEquals(tile.getName(), "tile"); | ||
} | ||
@Test | ||
void getPImageTest() { | ||
assertEquals(tile.getPImage(), image); | ||
} | ||
@Test | ||
void getTileTypeTest() { | ||
assertEquals(tile.getTileType(), Tile.TileType.BACKGROUND); | ||
} | ||
@Test | ||
void getPositionTest() { | ||
PVector vector = new PVector(Tileset.TILESETWIDTH, 0); // as ID = 1 | ||
assertEquals(tile.getPosition(), vector); | ||
} | ||
private Tile tile; | ||
private PImage image; | ||
|
||
@BeforeEach | ||
void setup() { | ||
image = mock(PImage.class); | ||
tile = new Tile(1, "tile", image, Tile.TileType.BACKGROUND); | ||
} | ||
|
||
@Test | ||
void constructorTest() { | ||
assertNotNull(tile); | ||
} | ||
|
||
@Test | ||
void getIDTest() { | ||
assertEquals(tile.getId(), 1); | ||
} | ||
|
||
@Test | ||
void getNameTest() { | ||
assertEquals(tile.getName(), "tile"); | ||
} | ||
|
||
@Test | ||
void getPImageTest() { | ||
assertEquals(tile.getPImage(), image); | ||
} | ||
|
||
@Test | ||
void getTileTypeTest() { | ||
assertEquals(tile.getTileType(), Tile.TileType.BACKGROUND); | ||
} | ||
|
||
@Test | ||
void getPositionTest() { | ||
PVector vector = new PVector(Tileset.TILESETWIDTH, 0); // as ID = 1 | ||
assertEquals(tile.getPosition(), vector); | ||
} | ||
} |