From 3bf3e0dda89059169ef47c69546b4a8b8ef36637 Mon Sep 17 00:00:00 2001 From: Sona Markosyan Date: Thu, 10 Feb 2022 01:32:57 +0100 Subject: [PATCH] add aircraft parameters should not be null or negative --- .../java/hs/fulda/de/ci/exam/project/AdminTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/test/java/hs/fulda/de/ci/exam/project/AdminTest.java b/src/test/java/hs/fulda/de/ci/exam/project/AdminTest.java index 7a90d65..f127a73 100644 --- a/src/test/java/hs/fulda/de/ci/exam/project/AdminTest.java +++ b/src/test/java/hs/fulda/de/ci/exam/project/AdminTest.java @@ -135,4 +135,17 @@ public class AdminTest { admin.addAircraft("Boeing", "787", 2003); }); } + @Test + public void addAircraftShouldThrowRuntimeExceptionWhenNull(){ + + assertThrows(RuntimeException.class, () -> { + admin.addAircraft(null, "787", 2003); + }); + assertThrows(RuntimeException.class, () -> { + admin.addAircraft("Boeing", "", 2003); + }); + assertThrows(RuntimeException.class, () -> { + admin.addAircraft("Boeing", "787", -2003); + }); + } }