public int getIndex(String name) {
        for (int i = 0; i < this.size(); i++) {
            if (get(i).getName().equals(name)) {
                return i;
            }
        }
        throw new IllegalArgumentException("param '" + name + "' not found");
    }
@Test
    public void getIndex_shouldThrowExceptionIfNameNotFound() {

        assertThatThrownBy(() -> new ParamsConfig().getIndex("foo"))
                .isInstanceOf(IllegalArgumentException.class)
                .hasMessage("param 'foo' not found");
    }