@@ -0,0 +1,2961 @@
+package io.teiler.api.service;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.test.context.TestPropertySource;%0Aimport org.springframework.test.context.junit4.SpringRunner;%0A%0Aimport io.teiler.server.Tylr;%0Aimport io.teiler.server.dto.Expense;%0Aimport io.teiler.server.dto.Group;%0Aimport io.teiler.server.dto.Person;%0Aimport io.teiler.server.dto.Share;%0A%0A@RunWith(SpringRunner.class)%0A@SpringBootTest(classes = Tylr.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)%0A@TestPropertySource(properties = %7B%22local.server.port=4567%22%7D)%0A@AutoConfigureTestDatabase%0Apublic class ExpenseServiceTest %7B%0A%0A    private static final String TEST_GROUP_NAME = %22Testgruppe%22;%0A%0A    private static final String TEST_EXPENSE_TITLE = %22Testausgabe%22;%0A    private static final Integer TEST_EXPENSE_AMOUNT = 4200;%0A    private static final Person TEST_PAYER = new Person(-1, %22Hans%22);%0A    private static final Person TEST_PROFITEER_1 = TEST_PAYER;%0A    private static final Person TEST_PROFITEER_2 = new Person(-2, %22Paul%22);%0A    private static final Person TEST_PROFITEER_3 = new Person(-3, %22Peter%22);%0A    private static final List%3CShare%3E TEST_SHARES = getTestShares();%0A%0A    @Autowired%0A    private ExpenseService expenseService;%0A    %0A    @Autowired%0A    private GroupService groupService;%0A    %0A    @Autowired%0A    private PersonService personService;%0A%0A    @Test%0A    public void testCreateExpenseWithSingleProfiteer() %7B%0A        Group testGroup = groupService.createGroup(TEST_GROUP_NAME);%0A        %0A        TEST_PROFITEER_1.setId(personService.createPerson(testGroup.getId(), TEST_PROFITEER_1.getName()).getId());%0A        TEST_PROFITEER_2.setId(personService.createPerson(testGroup.getId(), TEST_PROFITEER_2.getName()).getId());%0A        TEST_PROFITEER_3.setId(personService.createPerson(testGroup.getId(), TEST_PROFITEER_3.getName()).getId());%0A        %0A        Expense expense = expenseService.createExpense(TEST_EXPENSE_TITLE, TEST_EXPENSE_AMOUNT,%0A                TEST_PAYER, TEST_SHARES);%0A%0A        Assert.assertEquals(TEST_EXPENSE_TITLE, expense.getTitle());%0A        Assert.assertEquals(TEST_EXPENSE_AMOUNT, expense.getAmount());%0A        Assert.assertEquals(TEST_PAYER.getId(), expense.getPayer().getId());%0A        %0A        Assert.assertFalse(expense.getShares().isEmpty());%0A        Assert.assertEquals(TEST_SHARES.size(), expense.getShares().size());%0A    %7D%0A%0A    private static List%3CShare%3E getTestShares() %7B%0A        List%3CShare%3E shares = new ArrayList%3C%3E(3);%0A        shares.add(new Share(null, TEST_PROFITEER_1, 0.3));%0A        shares.add(new Share(null, TEST_PROFITEER_2, 0.3));%0A        shares.add(new Share(null, TEST_PROFITEER_3, 0.4));%0A        return shares;%0A    %7D%0A%0A%7D%0A

add expense service unit test (#173)