Invalid case test.
This commit is contained in:
parent
bee1feb93c
commit
5332703017
@ -1,19 +1,75 @@
|
||||
package pl.amu.edu.demo.logic;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import pl.amu.edu.demo.data.Address;
|
||||
import pl.amu.edu.demo.data.Housing;
|
||||
import pl.amu.edu.demo.data.Person;
|
||||
import pl.amu.edu.demo.data.WeWillStealYourFlatCheckResult;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TestWeWillStealYourFlatProduct {
|
||||
|
||||
@Test
|
||||
public void shouldBeValid() {
|
||||
// given
|
||||
/* preconditions */
|
||||
var person = Person.builder()
|
||||
.displayName("Miś Uszatek")
|
||||
.firstName("Miś")
|
||||
.lastName("Uszatek")
|
||||
.birthDate(LocalDate.of(1957, 3, 6))
|
||||
.housing(
|
||||
Housing.builder()
|
||||
.address(
|
||||
Address.builder()
|
||||
.withAddressLine1("Stumilowy las 5")
|
||||
.withZipCode("99-999")
|
||||
.build()
|
||||
).isApartment(true)
|
||||
.area(36.0)
|
||||
.build()
|
||||
).isMarried(false)
|
||||
.build();
|
||||
var logic = new WeWillStealYourFlatProduct();
|
||||
|
||||
// when
|
||||
/* when we perform an action */
|
||||
var result = logic.check(person);
|
||||
|
||||
// then
|
||||
/* assert that everything works as expected */
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result).isEqualTo(WeWillStealYourFlatCheckResult.ELIGIBLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotBeValid() {
|
||||
// given
|
||||
var person = Person.builder()
|
||||
.displayName("Maksymilian Paradys")
|
||||
.firstName("Maxymilian")
|
||||
.lastName("Paradys")
|
||||
.birthDate(LocalDate.of(1958, 11, 19))
|
||||
.housing(
|
||||
Housing.builder()
|
||||
.address(
|
||||
Address.builder()
|
||||
.withAddressLine1("Blockhaus C")
|
||||
.withZipCode("99-119")
|
||||
.build()
|
||||
).isApartment(false)
|
||||
.area(6543.0)
|
||||
.build()
|
||||
).isMarried(true)
|
||||
.build();
|
||||
var logic = new WeWillStealYourFlatProduct();
|
||||
|
||||
// when
|
||||
var result = logic.check(person);
|
||||
|
||||
// then
|
||||
assertThat(result).isNotNull();
|
||||
assertThat(result).isEqualTo(WeWillStealYourFlatCheckResult.NOT_ELIGIBLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user