The actual result is "We do not have any sets for this gear." and it is the correct result. The expected result in the test case is set incorrectly. ---- @Test public void testExecuteWhenValidCommandThenSuccess() { Member m1 = new Member("001", "keith"); Member m2 = new Member("002", "jason"); Member m3 = new Member("003", "paul"); Gear e1 = new Gear("E1", "3D_Scanner"); Gear e2 = new Gear("E2", "Smart_Glasses"); cmd.execute(new String[] {"listGearStatus"}); String expected = """ [E1 3D_Scanner] Current status: Unvailable [E2 Smart_Glasses] Current status: Unvailable """; assertEquals(expected, outContent.toString()); CmdArrive cmdArrive = new CmdArrive(); cmdArrive.execute(new String[] {"arrive", "E1"}); cmdArrive.execute(new String[] {"arrive", "E2"}); outContent.reset(); cmd.execute(new String[] {"listMemberStatus"}); expected = """ [E1 3D_Scanner] E1_1 Current status: Available [E2 Smart_Glasses] E2_1 Current status: Available """; assertEquals(expected, outContent.toString());
Changed the code to be: String expected = """ [E1 3D_Scanner] We do not have any sets for this gear. [E2 Smart_Glasses] We do not have any sets for this gear. """;