From f41c71f31f49ac56004e981740874dbdab940d64 Mon Sep 17 00:00:00 2001 From: Sona Markosyan Date: Thu, 10 Feb 2022 00:53:48 +0100 Subject: [PATCH] search flight should not be null --- src/test/java/hs/fulda/de/ci/exam/project/AdminTest.java | 8 ++++++++ 1 file changed, 8 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 bee72b8..659ad74 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 @@ -110,4 +110,12 @@ public class AdminTest { assertEquals(admin.searchFlights("1"), flight1.toString()); } + @Test + public void test_searchFlightThrowsExceptionWhenBlank(){ + when(flightRepository.findFlightByFlightNumber(any(String.class))).thenReturn(""); + assertThrows(RuntimeException.class, () -> { + admin.searchFlights("1"); + }); + } + }