Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.emfxe.test
- import com.emfxe.model.position.OpenPosition
- import org.junit.Test
- import org.junit.Assert
- import java.math.BigDecimal
- class OpenPositionTest {
- val firstOpenPosition = OpenPosition(100000482,153.toBigDecimal(),1, 20181,1.2566.toBigDecimal(), BigDecimal.ZERO,BigDecimal.ZERO,"15-02-2019", 1, BigDecimal.ONE, 23,"name", 123.toBigDecimal(), "USD", "USD", 1.23.toBigDecimal(), 1, 52.toBigDecimal(), 10000.toBigDecimal(),5)
- val secondOpenPosition = OpenPosition(100000482,153.toBigDecimal(),1, 2018,1.2566.toBigDecimal(), BigDecimal.ZERO,BigDecimal.ZERO,"15-02-2019", 1, BigDecimal.ONE, 23,"name", 123.toBigDecimal(), "USD", "USD", 1.23.toBigDecimal(), 1, 52.toBigDecimal(), 10000.toBigDecimal(),5)
- //check formattedNav
- @Test
- fun checkIsSameForEqualsPositions(){
- val openPositionEqualsFirstOpenPosition = OpenPosition(100000482,153.toBigDecimal(),1, 20181,1.2566.toBigDecimal(), BigDecimal.ZERO,BigDecimal.ZERO,"15-02-2019", 1, BigDecimal.ONE, 23,"name", 123.toBigDecimal(), "USD", "USD", 1.23.toBigDecimal(), 1, 52.toBigDecimal(), 10000.toBigDecimal(),5)
- Assert.assertTrue(this.firstOpenPosition.isSame(openPositionEqualsFirstOpenPosition))
- }
- @Test
- fun checkIsSameForNotEqualsPositions(){
- val same = this.firstOpenPosition.isSame(this.secondOpenPosition)
- Assert.assertFalse(same)
- }
- //check getCurrentValue
- @Test
- fun checkGetCurrentValue(){
- //не работает
- val currentValue : String = firstOpenPosition.getCurrentValue(4.toBigDecimal())
- }
- @Test
- fun checkGetCurrentValueWithNullQty(){
- Assert.assertEquals("-", firstOpenPosition.getCurrentValue(null))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement