Testing and updating the function 'getMessages(String id)'