public List<SearchResult> getSearchResults(String query) throws IOException {
        Elements results = fetchSearchResults(query);
        List<SearchResult> resultList = new ArrayList<>();

        for (Element result : results) {
            Element title = result.getElementsByClass("links_main").first().getElementsByTag("a").first();
            Element snippet = result.getElementsByClass("result__snippet").first();
            String snippetText = snippet.text().substring(0, snippet.text().length() > 250 ? 250 : snippet.text().length());

            resultList.add(new SearchResult(title.attr("href"), title.text(), snippetText));
        }

        return resultList.subList(0, resultList.size() > 5 ? 5 : resultList.size());
    }
@Test
    void testGetSearchResultsLimitTo5() throws IOException {
        searchWebAction = new SearchWebAction() {
            @Override
            Elements fetchSearchResults(String query) {
                Elements mockResults = new Elements();
                for (int i = 1; i <= 6; i++) {
                    mockResults.add(createMockResult("http://example" + i + ".com", "Title " + i, "Snippet " + i));
                }
                return mockResults;
            }
        };

        List<SearchWebAction.SearchResult> results = searchWebAction.getSearchResults("test query");

        assertEquals(5, results.size());
        assertEquals("http://example1.com", results.get(0).url());
        assertEquals("http://example5.com", results.get(4).url());
    }