Add test source junit 5 and updated the exception
This commit is contained in:
parent
226b97d7e9
commit
9204d68e44
@ -11,4 +11,5 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation(kotlin("stdlib"))
|
||||
testImplementation("org.junit.vintage:junit-vintage-engine:5.6.2")
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.cubetiqs.libra.moneyutils
|
||||
|
||||
class Main {
|
||||
fun run() = print("Just mind!")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
Main().run()
|
||||
val money = Money(10.0)
|
||||
val money2 = Money(20.0)
|
||||
money *= money
|
||||
println((money + money2) * money2)
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
package com.cubetiqs.libra.moneyutils
|
||||
|
||||
class MoneyCurrencyStateException(message: String? = null) : IllegalStateException(message ?: "money currency not found!")
|
||||
/**
|
||||
* Default money currency state exception
|
||||
*/
|
||||
class MoneyCurrencyStateException(message: String? = null) :
|
||||
IllegalStateException(message ?: "money currency is illegal state!")
|
17
src/test/kotlin/MoneyTests.kt
Normal file
17
src/test/kotlin/MoneyTests.kt
Normal file
@ -0,0 +1,17 @@
|
||||
import com.cubetiqs.libra.moneyutils.Money
|
||||
import com.cubetiqs.libra.moneyutils.plus
|
||||
import com.cubetiqs.libra.moneyutils.times
|
||||
import com.cubetiqs.libra.moneyutils.timesAssign
|
||||
import org.junit.Assert
|
||||
import org.junit.Test
|
||||
|
||||
class MoneyTests {
|
||||
@Test
|
||||
fun test() {
|
||||
val money = Money(10.0)
|
||||
val money2 = Money(20.0)
|
||||
money *= money
|
||||
println((money + money2) * money2)
|
||||
Assert.assertEquals(10, 10)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user