class RequestFilter {

    public boolean isMatch(@NonNull String url) {
        for (String r : regex) {
            String trimUrl = url.split("\\?")[0];
            if (!trimUrl.endsWith("/")) {
                trimUrl = trimUrl + "/";
            }
            if (trimUrl.matches(r)) {
                return true;
            }
        }
        return false;
    }

}

class RequestFilterTest {

    @Test
    public void isMatch_exact() {

        RequestFilter requestFilter = new RequestFilter(Collections.singletonList("https://www.test.com/todos"));
        assertFalse(requestFilter.isMatch("https://www.test.com/todos/1"));
        assertFalse(requestFilter.isMatch("https://www.test.com/todos/1/"));
        assertTrue(requestFilter.isMatch("https://www.test.com/todos/"));
        assertTrue(requestFilter.isMatch("https://www.test.com/todos"));
        assertTrue(requestFilter.isMatch("https://www.test.com/todos?query=1"));
    }

}