Bug 790

Summary: testExecuteWhenValidCommandThenSuccess
Product: Gear and Member Management System for library Reporter: keithlam5
Component: TestAssignee: keithlam5
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: ---    
Version: unspecified   
Hardware: PC   
OS: Windows   

Description keithlam5 2023-11-27 22:24:40 HKT
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());
Comment 1 keithlam5 2023-11-27 22:35:53 HKT
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.
                  
                """;