This repository has been archived on 2020-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
e-commerce/prototype/src/test/java/org/hso/ecommerce/action/booking/CreateBookingTest.java

38 lines
1.2 KiB
Java

package org.hso.ecommerce.action.booking;
import static org.junit.jupiter.api.Assertions.*;
import org.hso.ecommerce.entities.booking.Booking;
import org.hso.ecommerce.entities.booking.BookingAccountEntry;
import org.hso.ecommerce.entities.booking.BookingReason;
import org.junit.jupiter.api.Test;
class CreateBookingTest {
@Test
void test() {
BookingAccountEntry sourceAccount = new BookingAccountEntry();
sourceAccount.isMainAccount = true;
sourceAccount.newSumCent = 600_00;
BookingAccountEntry destinationAccount = new BookingAccountEntry();
destinationAccount.isVATAccount = true;
destinationAccount.newSumCent = 100_00;
BookingReason reason = new BookingReason();
reason.comment = "some test";
Booking result = new CreateBookingAction(sourceAccount, destinationAccount, reason, 42_00).finish();
assertTrue(result.source.isMainAccount);
assertFalse(result.source.isVATAccount);
assertEquals(558_00, result.source.newSumCent);
assertFalse(result.destination.isMainAccount);
assertTrue(result.destination.isVATAccount);
assertEquals(142_00, result.destination.newSumCent);
assertEquals("some test", result.reason.comment);
assertEquals(42_00, result.amountCent);
}
}