-
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
aa80368
commit 3bb6c9f
Showing
13 changed files
with
169 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# 4 space indentation | ||
[*.{java,xml,json}] | ||
indent_style = tab | ||
indent_size = 2 | ||
|
||
# Max 120 chars per line | ||
[*.{java,xml,json}] | ||
max_line_length = 140 |
3 changes: 2 additions & 1 deletion
3
src/main/java/dev/indoors/ringrats/service/SimulationService.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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package dev.indoors.ringrats.service; | ||
|
||
import dev.indoors.ringrats.simulation.match.MatchConfiguration; | ||
import dev.indoors.ringrats.simulation.match.MatchResults; | ||
|
||
public interface SimulationService { | ||
|
||
void simulateMatch(MatchConfiguration matchConfig); | ||
MatchResults simulateMatch(MatchConfiguration matchConfig); | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/indoors/ringrats/simulation/match/MatchResults.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,11 @@ | ||
package dev.indoors.ringrats.simulation.match; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Setter | ||
@Slf4j | ||
public class MatchResults { | ||
} |
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,15 +1,15 @@ | ||
{ | ||
"wrestlers": [ | ||
{ | ||
"name": "Chudd" | ||
}, | ||
{ | ||
"name": "Rufus" | ||
} | ||
], | ||
"stipulations": [ | ||
{ | ||
"name": "OneFall" | ||
} | ||
] | ||
} | ||
"wrestlers": [ | ||
{ | ||
"name": "Chudd" | ||
}, | ||
{ | ||
"name": "Rufus" | ||
} | ||
], | ||
"stipulations": [ | ||
{ | ||
"name": "OneFall" | ||
} | ||
] | ||
} |
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 was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
src/test/java/dev/indoors/ringrats/service/SimulationServiceTests.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,24 @@ | ||
package dev.indoors.ringrats.service; | ||
|
||
import dev.indoors.ringrats.service.impl.SimulationServiceImpl; | ||
import dev.indoors.ringrats.simulation.match.MatchResults; | ||
import dev.indoors.ringrats.util.MockMatchConfigurations; | ||
import dev.indoors.ringrats.util.MockWrestlers; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.InjectMocks; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest | ||
public class SimulationServiceTests { | ||
|
||
@InjectMocks | ||
SimulationServiceImpl simService; | ||
|
||
@Test | ||
void firstTest() { | ||
MatchResults results = simService.simulateMatch(MockMatchConfigurations.basicOneFall(MockWrestlers.create("Wang Chung", "Dangerous Davey"))); | ||
assertThat(results).isNotNull(); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/dev/indoors/ringrats/util/MockMatchConfigurations.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,22 @@ | ||
package dev.indoors.ringrats.util; | ||
|
||
import dev.indoors.ringrats.simulation.match.MatchConfiguration; | ||
import dev.indoors.ringrats.simulation.stipulation.OneFallStipulation; | ||
import dev.indoors.ringrats.simulation.wrestler.Wrestler; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
|
||
public final class MockMatchConfigurations { | ||
|
||
private MockMatchConfigurations() { | ||
throw new UnsupportedOperationException("Utility class not intended for instantiation."); | ||
} | ||
|
||
public static MatchConfiguration basicOneFall(Set<Wrestler> wrestlers) { | ||
MatchConfiguration configuration = new MatchConfiguration(); | ||
configuration.setStipulations(Collections.singleton(new OneFallStipulation())); | ||
configuration.setWrestlers(wrestlers); | ||
return configuration; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/java/dev/indoors/ringrats/util/MockWrestlers.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,28 @@ | ||
package dev.indoors.ringrats.util; | ||
|
||
import dev.indoors.ringrats.simulation.wrestler.Wrestler; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public final class MockWrestlers { | ||
|
||
private MockWrestlers() { | ||
throw new UnsupportedOperationException("Utility class not intended for instantiation."); | ||
} | ||
|
||
public static Wrestler create(String name) { | ||
Wrestler wrestler = new Wrestler(); | ||
wrestler.setName(name); | ||
return wrestler; | ||
} | ||
|
||
public static Set<Wrestler> create(String... names) { | ||
Set<Wrestler> wrestlers = new HashSet<>(); | ||
for (String name : names) { | ||
wrestlers.add(create(name)); | ||
} | ||
return wrestlers; | ||
} | ||
|
||
} |
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,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
|
||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<appender name="File" class="ch.qos.logback.core.FileAppender"> | ||
<file>logs/ring-rats.log</file> | ||
<encoder> | ||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="ERROR"> | ||
<appender-ref ref="Console"/> | ||
<appender-ref ref="File"/> | ||
</root> | ||
|
||
<!-- Quiet down, you--> | ||
<logger name="org.springframework.context" level="ERROR"/> | ||
<logger name="org.springframework.beans.factory" level="ERROR"/> | ||
<logger name="org.springframework.boot.autoconfigure.logging" level="ERROR"/> | ||
|
||
</configuration> |