added invalid offerexception test

This commit is contained in:
Alexander Maier
2023-06-27 18:10:25 +02:00
parent 0b403d73ea
commit 0eb0f903c6

View File

@@ -1,9 +1,13 @@
package de.rwu.easydrop.service.validation; package de.rwu.easydrop.service.validation;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import de.rwu.easydrop.exception.InvalidOfferException;
import de.rwu.easydrop.model.Offer; import de.rwu.easydrop.model.Offer;
@@ -19,5 +23,13 @@ public class OfferValidatorTest {
// Act and Assert // Act and Assert
assertDoesNotThrow(() -> OfferValidator.validate(offer)); assertDoesNotThrow(() -> OfferValidator.validate(offer));
} }
@ParameterizedTest
@MethodSource("invalidOffer")
void validate_InvalidOffer_ThrowsInvalidOfferException(Offer offer) {
// Act and Assert
assertThrows(InvalidOfferException.class, () -> OfferValidator.validate(offer));
}
} }