-
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.
Remove the last remnants of JUnit4 (#123)
- Loading branch information
Showing
7 changed files
with
40 additions
and
33 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,22 +1,31 @@ | ||
package com.team766; | ||
|
||
import com.team766.config.ConfigFileReader; | ||
import com.team766.config.ConfigFileTestUtils; | ||
import com.team766.framework.Scheduler; | ||
import com.team766.hal.RobotProvider; | ||
import com.team766.hal.mock.TestRobotProvider; | ||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import org.junit.jupiter.api.BeforeEach; | ||
|
||
public abstract class TestCase extends junit.framework.TestCase { | ||
public abstract class TestCase { | ||
|
||
@Override | ||
protected void setUp() throws Exception { | ||
ConfigFileReader.instance = new ConfigFileReader(this.getClass().getClassLoader().getResource("testConfig.txt").getPath()); | ||
RobotProvider.instance = new TestRobotProvider(); | ||
@BeforeEach | ||
public void setUp() { | ||
ConfigFileTestUtils.resetStatics(); | ||
Scheduler.getInstance().reset(); | ||
|
||
Scheduler.getInstance().reset(); | ||
} | ||
RobotProvider.instance = new TestRobotProvider(); | ||
} | ||
|
||
protected void step() { | ||
Scheduler.getInstance().run(); | ||
} | ||
protected void loadConfig(String configJson) throws IOException { | ||
var configFilePath = Files.createTempFile("testConfig", ".txt"); | ||
Files.writeString(configFilePath, configJson); | ||
ConfigFileReader.instance = new ConfigFileReader(configFilePath.toString()); | ||
} | ||
|
||
protected void step() { | ||
Scheduler.getInstance().run(); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.team766.config; | ||
|
||
public class ConfigFileTestUtils { | ||
public static void resetStatics() { | ||
AbstractConfigValue.resetStatics(); | ||
} | ||
} |
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