feat: broken sql tests

This commit is contained in:
aro 2023-01-23 18:12:23 +01:00
parent 974a6facc3
commit 7484b40cfc
3 changed files with 4 additions and 5 deletions

View file

@ -19,9 +19,6 @@
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version> <version>3.0.0-M7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>

View file

@ -34,6 +34,8 @@ public class SQLStorage extends Storage {
@Override @Override
public ActionResult<Void> store(UUID uuid, NickoProfile profile) { public ActionResult<Void> store(UUID uuid, NickoProfile profile) {
final Connection connection = getProvider().getConnection(); final Connection connection = getProvider().getConnection();
if (connection == null) return new ActionResult<>(I18NDict.Error.SQL_ERROR);
try { try {
final String sql = """ final String sql = """
INSERT IGNORE INTO nicko.DATA INSERT IGNORE INTO nicko.DATA

View file

@ -34,12 +34,12 @@ public class BrokenSQLTest {
} }
@Test @Test
@DisplayName("Store Player Via SQL") @DisplayName("Fail to Store Player Via SQL")
public void storePlayer() { public void storePlayer() {
final PlayerMock playerMock = server.addPlayer(); final PlayerMock playerMock = server.addPlayer();
final NickoProfile profile = new NickoProfile("Notch", "Notch", Locale.ENGLISH, true); final NickoProfile profile = new NickoProfile("Notch", "Notch", Locale.ENGLISH, true);
final ActionResult<Void> storeAction = plugin.getDataStore().getStorage().store(playerMock.getUniqueId(), profile); final ActionResult<Void> storeAction = plugin.getDataStore().getStorage().store(playerMock.getUniqueId(), profile);
Assertions.assertFalse(storeAction.isError()); Assertions.assertTrue(storeAction.isError());
} }
@AfterAll @AfterAll