@Test
public void erroneousParameters() {

    try {
        Map<String,Object> args = map("text", "hello", "flag", true, "garbage", "!", "junk", "splat");
        instantiate(C.class,  args);
        Assert.fail("Instantiation should have failed due to unnecessary arguments");
    } catch (Exception e) {
        assertThat(e, Matchers.instanceOf(IllegalArgumentException.class));
        assertThat(e.getMessage(), is("WARNING: Unknown parameter(s) found for class type '" +
            C.class.getName() + "': garbage,junk"));
    }
}