Skip to content

Commit

Permalink
Merge pull request #82 from RVRX/RVRX-patch-1
Browse files Browse the repository at this point in the history
Add Gradle test build Action
  • Loading branch information
RVRX authored Jul 18, 2021
2 parents 6bd2f14 + 40c7773 commit 9192fa5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 44 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ jobs:
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '8'
distribution: 'adopt'
java-package: jdk+fx # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build -b build.gradle --info -x test
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
group: 'de.jensd', name: 'fontawesomefx', version: '8.9', // https://mvnrepository.com/artifact/de.jensd/fontawesomefx
)

testCompile(
testImplementation(
"org.testfx:testfx-core:4.0.16-alpha",
'org.junit.jupiter:junit-jupiter:5.6.0',
'org.testfx:testfx-junit5:4.0.16-alpha',
Expand Down
50 changes: 9 additions & 41 deletions src/test/java/goistreamtoolredux/AlgorithmTest.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package goistreamtoolredux;

import goistreamtoolredux.algorithm.FileManager;
import goistreamtoolredux.algorithm.InvalidDataException;
import goistreamtoolredux.algorithm.LobbyTimer;
import goistreamtoolredux.algorithm.Team;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.io.File;
Expand All @@ -15,49 +15,23 @@
import java.util.prefs.Preferences;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;


/**
* Tests for Algorithm (Non-UI tests)
*/
public class AlgorithmTest {

@Test
public void settingAndGettingInitialTimerTest() throws IOException, InvalidDataException {
LobbyTimer lobbyTimer = LobbyTimer.getInstance();

//10
lobbyTimer.setInitialTimerLength(10);
assertEquals(10, lobbyTimer.getInitialTimerLength());


//120
lobbyTimer.setInitialTimerLength(120);
assertEquals(120, lobbyTimer.getInitialTimerLength());

Exception exception = assertThrows(NumberFormatException.class, () -> {
Integer.parseInt("1a");
});
}

/**
* setting initial value to 0 is not allowed. Would cause a loop of
* <pre>start() -> restart() -> start()</pre>
* due to start calling restart if timer is 0, and restart starting
* from the initial value (which would be 0), then calling start.
*/
@Test
public void exceptionSetInitialTimerInvalidTest() {
//setting initial value to 0 is not allowed. Would cause a "start() -> restart() -> start()" loop
// due to start calling restart if timer is 0, and restart starting from the initial value (which would be 0)
// then calling start
Exception exception = assertThrows(IllegalArgumentException.class, () -> {
LobbyTimer.getInstance().setInitialTimerLength(0);
});
@BeforeAll
static void verify() {
try {
FileManager.verifyContent();
} catch (IOException exception) {
exception.printStackTrace();
System.err.println("Could not verify content for tests!");
}
}


@Test
public void readTeamsFromDiskTest() throws IOException {
LinkedList<Team> teamLinkedList = Team.getAllTeamsFromDisk();
Expand Down Expand Up @@ -91,12 +65,6 @@ public void convertFromMinTest() {
assertEquals(0, LobbyTimer.convertFromMinuteFormat("0:00"));
}

@Test
public void getSCSBracketsTest() {
FileManager.getScsBracket(353);
}


@Test
public void setOutputPathPreference() {
String foo; // 'outputTest' directory
Expand Down

0 comments on commit 9192fa5

Please sign in to comment.