class QueryMatcher implements Serializable {

    public boolean matches(String... queryTerms) {
        for (String queryTerm : queryTerms) {
            for (String entityTerm : entityTerms) {
                if (entityTerm.contains(queryTerm.toUpperCase())) {
                    return true;
                }
            }
        }

        return false;
    }

}

class QueryMatcherTest {

    @Test
    public void test() {

        QueryMatcher matcher = new QueryMatcher("Jair Bolsonaro", "PP");
        boolean result = matcher.matches("bolsonaro");

        Assert.assertTrue(result);
    }

}