-
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.
Implement test for exchange USD to PLN (pass)
- Loading branch information
kamil.jedrzejuk
committed
Oct 2, 2024
1 parent
0905437
commit fab9b24
Showing
6 changed files
with
66 additions
and
9 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
10 changes: 10 additions & 0 deletions
10
...main/kotlin/camilyed/github/io/currencyexchangeapi/application/ExchangeUsdToPlnCommand.kt
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,10 @@ | ||
package camilyed.github.io.currencyexchangeapi.application | ||
|
||
import java.math.BigDecimal | ||
import java.util.UUID | ||
|
||
data class ExchangeUsdToPlnCommand( | ||
val accountId: UUID, | ||
val amount: BigDecimal, | ||
val exchangeRate: BigDecimal | ||
) |
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
29 changes: 29 additions & 0 deletions
29
...camilyed/github/io/currencyexchangeapi/testing/builders/ExchangeUsdToPlnCommandBuilder.kt
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,29 @@ | ||
package camilyed.github.io.currencyexchangeapi.testing.builders | ||
|
||
import camilyed.github.io.currencyexchangeapi.application.ExchangeUsdToPlnCommand | ||
import java.math.BigDecimal | ||
import java.util.* | ||
|
||
class ExchangeUsdToPlnCommandBuilder private constructor() { | ||
private var accountId: UUID = UUID.randomUUID() | ||
private var amount: BigDecimal = BigDecimal("100.00") | ||
private var exchangeRate: BigDecimal = BigDecimal("4.0") | ||
|
||
fun withAccountId(accountId: UUID) = apply { this.accountId = accountId } | ||
fun withAmount(amount: String) = apply { this.amount = BigDecimal(amount) } | ||
fun withExchangeRate(exchangeRate: String) = apply { this.exchangeRate = BigDecimal(exchangeRate) } | ||
|
||
fun build(): ExchangeUsdToPlnCommand { | ||
return ExchangeUsdToPlnCommand( | ||
accountId = accountId, | ||
amount = amount, | ||
exchangeRate = exchangeRate | ||
) | ||
} | ||
|
||
companion object { | ||
fun anExchangeToPln(): ExchangeUsdToPlnCommandBuilder { | ||
return ExchangeUsdToPlnCommandBuilder() | ||
} | ||
} | ||
} |