-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7212ca
commit 95960d5
Showing
4 changed files
with
69 additions
and
2 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
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 +1 @@ | ||
rootProject.name = 'reverseFLHook' | ||
rootProject.name = 'reverse-flhook' |
66 changes: 66 additions & 0 deletions
66
src/test/java/com/etiennelamoureux/reverseflhook/jump/HyperspaceCoordinatesServiceTest.java
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package com.etiennelamoureux.reverseflhook.jump; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotEquals; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
@ExtendWith(MockitoExtension.class) | ||
public class HyperspaceCoordinatesServiceTest { | ||
private static final String SYSTEM = "system"; | ||
private static final String BASE = "base"; | ||
private static final float X = 1; | ||
private static final float Y = 2; | ||
private static final float Z = 3; | ||
private static final Coordinates COORDS = new Coordinates(X, Y, Z); | ||
|
||
@Mock | ||
private CoordinatesRepository coordinatesRepository; | ||
|
||
@InjectMocks | ||
private HyperspaceCoordinatesService hyperspaceCoordinatesService; | ||
|
||
@Test | ||
public void givenNotAdminWhenSurveyingCoordsThenBlur() { | ||
HyperspaceCoordinates hyperspaceCoordinates = | ||
hyperspaceCoordinatesService.survey(SYSTEM, X, Y, Z); | ||
|
||
assertNotEquals(COORDS, hyperspaceCoordinates.getCoordinates()); | ||
} | ||
|
||
@Test | ||
public void givenNotAdminWhenSurveyingBaseThenBlur() { | ||
when(coordinatesRepository.findOneBySystemAndBase(SYSTEM, BASE)) | ||
.thenReturn(new Coordinates(X, Y, Z)); | ||
|
||
HyperspaceCoordinates hyperspaceCoordinates = hyperspaceCoordinatesService.survey(SYSTEM, BASE); | ||
|
||
assertNotEquals(COORDS, hyperspaceCoordinates.getCoordinates()); | ||
} | ||
|
||
@Test | ||
public void givenAdminWhenSurveyingCoordsThenDontBlur() { | ||
hyperspaceCoordinatesService.isAdminMode(); | ||
|
||
HyperspaceCoordinates hyperspaceCoordinates = | ||
hyperspaceCoordinatesService.survey(SYSTEM, X, Y, Z); | ||
|
||
assertEquals(COORDS, hyperspaceCoordinates.getCoordinates()); | ||
} | ||
|
||
@Test | ||
public void givenAdminWhenSurveyingBaseThenDontBlur() { | ||
when(coordinatesRepository.findOneBySystemAndBase(SYSTEM, BASE)) | ||
.thenReturn(new Coordinates(X, Y, Z)); | ||
hyperspaceCoordinatesService.isAdminMode(); | ||
|
||
HyperspaceCoordinates hyperspaceCoordinates = hyperspaceCoordinatesService.survey(SYSTEM, BASE); | ||
|
||
assertEquals(COORDS, hyperspaceCoordinates.getCoordinates()); | ||
} | ||
} |