Skip to content

Commit

Permalink
Implement account creation to pass test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil.jedrzejuk committed Oct 1, 2024
1 parent 4224e56 commit b3bd216
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package camilyed.github.io.currencyexchangeapi

import java.util.UUID

data class Account(
val id: UUID,
val owner: String,
val balancePln: Double
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package camilyed.github.io.currencyexchangeapi

import java.util.*

class AccountService {

fun create(name: String, balance: Double): Account {
return Account(id = UUID.randomUUID(), owner = name, balancePln = balance)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package camilyed.github.io.currencyexchangeapi

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test

class AccountServiceTest {

var accountService = AccountService()

@Test
fun `should create a new account with valid details`() {
// given
Expand All @@ -18,4 +22,4 @@ class AccountServiceTest {
assertEquals(initialBalance, account.balancePln, "Account balance in PLN should match initial balance")
assertEquals(name, account.owner, "Account owner name should match provided name")
}
}
}

0 comments on commit b3bd216

Please sign in to comment.