Skip to content

Commit

Permalink
Added formatting rules description and applied to TileTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
danmigdev committed Jul 27, 2024
1 parent a0c3bd8 commit 611866f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 40 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ It is recommended to create a commit every time you complete a task:
That's it for the Source tree setup! Now, you are ready to [open up the code editor](wiki). Don't forget to come back to this file when you are ready to know about [the Process of Making Changes](#the-process-of-making-changes).

## The Process of Making Changes
### Before starting coding... formatting rules!
Having a codebase formatted consistently makes things easier. Code will be easier to understand for new contributors and the risk of mistakes will be reduced.
Make sure to configure your IDE so that it uses **Eclipse_formatter.xml** file rules. You can also tell your IDE to automatically format the code before each save action. It is importanto to make sure that the code is formatted before any commit.

### Issues
You are now ready to contribute! Github represents tasks as issues. You can find all of the issues [here](https://github.com/Stephcraft/Project-16x16/issues) or in the **Issues** tab of the repository. If you found a bug, would like to add a feature or simply do not find something interesting to contribute to, then you can [create your own issue](https://github.com/Stephcraft/Project-16x16/issues/new).

Expand Down
85 changes: 45 additions & 40 deletions src/test/java/project_16x16/components/TileTest.java
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);
}
}

0 comments on commit 611866f

Please sign in to comment.