class ArgumentPatternMatcher {

    public static List<String> arguments(Pattern pattern, String state) {
        final List<String> argumentsValues = new ArrayList<>();
        Matcher matcher = pattern.matcher(state);
        if (matcher.lookingAt()) {
            for (int i = 1; i <= matcher.groupCount(); i++) {
                int startIndex = matcher.start(i);

                if (startIndex == -1) {
                    argumentsValues.add("");
                } else {
                    argumentsValues.add(matcher.group(i));
                }
            }
        }

        return argumentsValues;
    }

}

class ArgumentPatternMatcherTest {

    @Test
    public void should_not_extract_anything_if_no_matches() {

        List<String> arguments = ArgumentPatternMatcher.arguments(Pattern.compile("The following animals: (.*)"),
            "I have 36 cukes in my belly");
        assertThat(arguments).isEmpty();
    }

}