diff --git a/totaleconomy-common/src/main/java/com/ericgrandt/totaleconomy/common/data/BalanceData.java b/totaleconomy-common/src/main/java/com/ericgrandt/totaleconomy/common/data/BalanceData.java index 99f04753..85a444b0 100644 --- a/totaleconomy-common/src/main/java/com/ericgrandt/totaleconomy/common/data/BalanceData.java +++ b/totaleconomy-common/src/main/java/com/ericgrandt/totaleconomy/common/data/BalanceData.java @@ -34,22 +34,6 @@ public BigDecimal getBalance(UUID accountId, int currencyId) throws SQLException return BigDecimal.ZERO; } - // TODO: Remove in favor of the BigDecimal updateBalance below - public int updateBalance(UUID accountId, int currencyId, double balance) throws SQLException { - String updateBalanceQuery = "UPDATE te_balance SET balance = ? WHERE account_id = ? AND currency_id = ?"; - - try ( - Connection conn = database.getDataSource().getConnection(); - PreparedStatement stmt = conn.prepareStatement(updateBalanceQuery) - ) { - stmt.setBigDecimal(1, BigDecimal.valueOf(balance)); - stmt.setString(2, accountId.toString()); - stmt.setInt(3, currencyId); - - return stmt.executeUpdate(); - } - } - public int updateBalance(UUID accountId, int currencyId, BigDecimal balance) throws SQLException { String updateBalanceQuery = "UPDATE te_balance SET balance = ? WHERE account_id = ? AND currency_id = ?"; diff --git a/totaleconomy-common/src/test/java/com/ericgrandt/totaleconomy/common/data/BalanceDataTest.java b/totaleconomy-common/src/test/java/com/ericgrandt/totaleconomy/common/data/BalanceDataTest.java index 0e134ffa..bb311ba6 100644 --- a/totaleconomy-common/src/test/java/com/ericgrandt/totaleconomy/common/data/BalanceDataTest.java +++ b/totaleconomy-common/src/test/java/com/ericgrandt/totaleconomy/common/data/BalanceDataTest.java @@ -87,7 +87,7 @@ public void updateBalance_WithBalanceUpdated_ShouldReturnOne() throws SQLExcepti BalanceData sut = new BalanceData(databaseMock); // Act - int actual = sut.updateBalance(UUID.randomUUID(), 1, 100); + int actual = sut.updateBalance(UUID.randomUUID(), 1, BigDecimal.valueOf(100)); int expected = 1; // Assert @@ -109,7 +109,7 @@ public void updateBalance_WithNoBalanceUpdated_ShouldReturnZero() throws SQLExce BalanceData sut = new BalanceData(databaseMock); // Act - int actual = sut.updateBalance(UUID.randomUUID(), 1, 100); + int actual = sut.updateBalance(UUID.randomUUID(), 1, BigDecimal.valueOf(100)); int expected = 0; // Assert @@ -159,7 +159,7 @@ public void updateBalance_ShouldUpdateBalance() throws SQLException { BalanceData sut = new BalanceData(databaseMock); // Act - int actual = sut.updateBalance(accountId, currencyId, 100); + int actual = sut.updateBalance(accountId, currencyId, BigDecimal.valueOf(100)); int expected = 1; BalanceDto actualBalanceDto = TestUtils.getBalanceForAccountId(accountId, currencyId); diff --git a/totaleconomy-sponge/src/main/java/com/ericgrandt/totaleconomy/impl/EconomyImpl.java b/totaleconomy-sponge/src/main/java/com/ericgrandt/totaleconomy/impl/EconomyImpl.java index 9f40c7d3..4b6cb10a 100644 --- a/totaleconomy-sponge/src/main/java/com/ericgrandt/totaleconomy/impl/EconomyImpl.java +++ b/totaleconomy-sponge/src/main/java/com/ericgrandt/totaleconomy/impl/EconomyImpl.java @@ -23,7 +23,6 @@ public class EconomyImpl implements EconomyService { private final Currency currency; - // TODO: Replace data params with CommonEconomy public EconomyImpl( final SpongeWrapper spongeWrapper, final CurrencyDto currencyDto,