added invalid offerexception test
This commit is contained in:
@@ -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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user