mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Add unit tests to the staff package
The main purpose of this commit is to achieve 100% (line) test coverage for the staff package.
This commit is contained in:
parent
6e4fe14339
commit
2f06261d87
33
src/test/java/catering/staff/StaffUnitTests.java
Normal file
33
src/test/java/catering/staff/StaffUnitTests.java
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
// SPDX-FileCopyrightText: 2024 swt23w23
|
||||||
|
package catering.staff;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
import static org.salespointframework.core.Currencies.EURO;
|
||||||
|
|
||||||
|
import org.javamoney.moneta.Money;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.annotation.DirtiesContext;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class StaffUnitTests {
|
||||||
|
private Employee defaultEmployee;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StaffManagement staffManagement;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setup() {
|
||||||
|
defaultEmployee = staffManagement.save(new Employee("Karl Baum", JobType.COOK, Money.of(10, EURO)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DirtiesContext
|
||||||
|
void staffNotEqualToDifferentClass() {
|
||||||
|
assertThat(defaultEmployee).isNotEqualTo(new Object());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue