📍Use lombok, reformat, and optimize the code (#1560)
* Use lombok, reformat, and optimize the code * Fix merge conflicts and some sonar issues Co-authored-by: va1m <va1m@email.com>
This commit is contained in:
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
|
||||
@Override
|
||||
final FlamingAsteroid getTestedObject() {
|
||||
@ -45,7 +45,7 @@ public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
* Test the constructor parameters
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
void testConstructor() {
|
||||
final var asteroid = new FlamingAsteroid(1, 2, 3, 4);
|
||||
assertEquals(1, asteroid.getLeft());
|
||||
assertEquals(2, asteroid.getTop());
|
||||
@ -60,7 +60,7 @@ public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
* Test what happens we collide with an asteroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideFlamingAsteroid() {
|
||||
void testCollideFlamingAsteroid() {
|
||||
testCollision(
|
||||
new FlamingAsteroid(1, 2, 3, 4),
|
||||
false, true,
|
||||
@ -72,7 +72,7 @@ public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
* Test what happens we collide with an meteoroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideMeteoroid() {
|
||||
void testCollideMeteoroid() {
|
||||
testCollision(
|
||||
new Meteoroid(1, 1, 3, 4),
|
||||
false, false,
|
||||
@ -84,7 +84,7 @@ public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
* Test what happens we collide with ISS
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationIss() {
|
||||
void testCollideSpaceStationIss() {
|
||||
testCollision(
|
||||
new SpaceStationIss(1, 1, 3, 4),
|
||||
true, true,
|
||||
@ -96,7 +96,7 @@ public class FlamingAsteroidTest extends CollisionTest<FlamingAsteroid> {
|
||||
* Test what happens we collide with MIR
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationMir() {
|
||||
void testCollideSpaceStationMir() {
|
||||
testCollision(
|
||||
new SpaceStationMir(1, 1, 3, 4),
|
||||
true, true,
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
|
||||
@Override
|
||||
final Meteoroid getTestedObject() {
|
||||
@ -44,7 +44,7 @@ public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
* Test the constructor parameters
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
void testConstructor() {
|
||||
final var meteoroid = new Meteoroid(1, 2, 3, 4);
|
||||
assertEquals(1, meteoroid.getLeft());
|
||||
assertEquals(2, meteoroid.getTop());
|
||||
@ -59,7 +59,7 @@ public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
* Test what happens we collide with an asteroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideFlamingAsteroid() {
|
||||
void testCollideFlamingAsteroid() {
|
||||
testCollision(
|
||||
new FlamingAsteroid(1, 1, 3, 4),
|
||||
false, true,
|
||||
@ -71,7 +71,7 @@ public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
* Test what happens we collide with an meteoroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideMeteoroid() {
|
||||
void testCollideMeteoroid() {
|
||||
testCollision(
|
||||
new Meteoroid(1, 1, 3, 4),
|
||||
false, false,
|
||||
@ -83,7 +83,7 @@ public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
* Test what happens we collide with ISS
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationIss() {
|
||||
void testCollideSpaceStationIss() {
|
||||
testCollision(
|
||||
new SpaceStationIss(1, 1, 3, 4),
|
||||
true, false,
|
||||
@ -95,7 +95,7 @@ public class MeteoroidTest extends CollisionTest<Meteoroid> {
|
||||
* Test what happens we collide with MIR
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationMir() {
|
||||
void testCollideSpaceStationMir() {
|
||||
testCollision(
|
||||
new SpaceStationMir(1, 1, 3, 4),
|
||||
true, false,
|
||||
|
@ -32,13 +32,13 @@ import org.junit.jupiter.api.Test;
|
||||
/**
|
||||
* Unit test for Rectangle
|
||||
*/
|
||||
public class RectangleTest {
|
||||
class RectangleTest {
|
||||
|
||||
/**
|
||||
* Test if the values passed through the constructor matches the values fetched from the getters
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
void testConstructor() {
|
||||
final var rectangle = new Rectangle(1, 2, 3, 4);
|
||||
assertEquals(1, rectangle.getLeft());
|
||||
assertEquals(2, rectangle.getTop());
|
||||
@ -51,7 +51,7 @@ public class RectangleTest {
|
||||
* #toString()}
|
||||
*/
|
||||
@Test
|
||||
public void testToString() throws Exception {
|
||||
void testToString() throws Exception {
|
||||
final var rectangle = new Rectangle(1, 2, 3, 4);
|
||||
assertEquals("[1,2,3,4]", rectangle.toString());
|
||||
}
|
||||
@ -60,7 +60,7 @@ public class RectangleTest {
|
||||
* Test if the {@link Rectangle} class can detect if it intersects with another rectangle.
|
||||
*/
|
||||
@Test
|
||||
public void testIntersection() {
|
||||
void testIntersection() {
|
||||
assertTrue(new Rectangle(0, 0, 1, 1).intersectsWith(new Rectangle(0, 0, 1, 1)));
|
||||
assertTrue(new Rectangle(0, 0, 1, 1).intersectsWith(new Rectangle(-1, -5, 7, 8)));
|
||||
assertFalse(new Rectangle(0, 0, 1, 1).intersectsWith(new Rectangle(2, 2, 3, 3)));
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
|
||||
@Override
|
||||
final SpaceStationIss getTestedObject() {
|
||||
@ -44,7 +44,7 @@ public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
* Test the constructor parameters
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
void testConstructor() {
|
||||
final var iss = new SpaceStationIss(1, 2, 3, 4);
|
||||
assertEquals(1, iss.getLeft());
|
||||
assertEquals(2, iss.getTop());
|
||||
@ -59,7 +59,7 @@ public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
* Test what happens we collide with an asteroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideFlamingAsteroid() {
|
||||
void testCollideFlamingAsteroid() {
|
||||
testCollision(
|
||||
new FlamingAsteroid(1, 1, 3, 4),
|
||||
false, true,
|
||||
@ -71,7 +71,7 @@ public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
* Test what happens we collide with an meteoroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideMeteoroid() {
|
||||
void testCollideMeteoroid() {
|
||||
testCollision(
|
||||
new Meteoroid(1, 1, 3, 4),
|
||||
false, false,
|
||||
@ -83,7 +83,7 @@ public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
* Test what happens we collide with ISS
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationIss() {
|
||||
void testCollideSpaceStationIss() {
|
||||
testCollision(
|
||||
new SpaceStationIss(1, 1, 3, 4),
|
||||
true, false,
|
||||
@ -95,7 +95,7 @@ public class SpaceStationIssTest extends CollisionTest<SpaceStationIss> {
|
||||
* Test what happens we collide with MIR
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationMir() {
|
||||
void testCollideSpaceStationMir() {
|
||||
testCollision(
|
||||
new SpaceStationMir(1, 1, 3, 4),
|
||||
true, false,
|
||||
|
@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* @author Jeroen Meulemeester
|
||||
*/
|
||||
public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
|
||||
@Override
|
||||
final SpaceStationMir getTestedObject() {
|
||||
@ -44,7 +44,7 @@ public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
* Test the constructor parameters
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
void testConstructor() {
|
||||
final var mir = new SpaceStationMir(1, 2, 3, 4);
|
||||
assertEquals(1, mir.getLeft());
|
||||
assertEquals(2, mir.getTop());
|
||||
@ -59,7 +59,7 @@ public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
* Test what happens we collide with an asteroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideFlamingAsteroid() {
|
||||
void testCollideFlamingAsteroid() {
|
||||
testCollision(
|
||||
new FlamingAsteroid(1, 1, 3, 4),
|
||||
false, true,
|
||||
@ -71,7 +71,7 @@ public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
* Test what happens we collide with an meteoroid
|
||||
*/
|
||||
@Test
|
||||
public void testCollideMeteoroid() {
|
||||
void testCollideMeteoroid() {
|
||||
testCollision(
|
||||
new Meteoroid(1, 1, 3, 4),
|
||||
false, false,
|
||||
@ -83,7 +83,7 @@ public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
* Test what happens we collide with ISS
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationIss() {
|
||||
void testCollideSpaceStationIss() {
|
||||
testCollision(
|
||||
new SpaceStationIss(1, 1, 3, 4),
|
||||
true, false,
|
||||
@ -95,7 +95,7 @@ public class SpaceStationMirTest extends CollisionTest<SpaceStationMir> {
|
||||
* Test what happens we collide with MIR
|
||||
*/
|
||||
@Test
|
||||
public void testCollideSpaceStationMir() {
|
||||
void testCollideSpaceStationMir() {
|
||||
testCollision(
|
||||
new SpaceStationMir(1, 1, 3, 4),
|
||||
true, false,
|
||||
|
Reference in New Issue
Block a user