Testing Apex REST code
To test Apex REST services, we must explicitly set RestRequest for the RestContext.request property that the methods will be using. Testing Apex REST methods is actually a very straightforward process in Apex as they are static methods that are globally scoped. For us to test the doGet method, we will need to first update the HospitalWrapper class to allow the test to view the Name and Ref_Code properties by annotating them with @TestVisible, as shown in the following snippet:
global class HospitalWrapper {
    @TestVisible
    String Name;
    @TestVisible
    String Ref_Code;
    public HospitalWrapper(Account acc) {
        if(acc != null) {
            this.Name = acc.Name;
            this.Ref_Code...