### Question:
ConsentCommands extends ConfiguredCommand<DPCConsentConfiguration> { @Override protected void run(Bootstrap<DPCConsentConfiguration> bootstrap, Namespace namespace, DPCConsentConfiguration dpcConsentConfiguration) throws Exception { final Command command = subcommands.get(namespace.getString(COMMAND_NAME_ATTR)); command.run(bootstrap, namespace); } ConsentCommands(); @Override void configure(Subparser subparser);  }### Answer:
@Test final void pertinentHelpMessageDisplayed() throws Exception { final boolean t1 = cli.run("consent", "create", "-h"); String errorMsg = String.format("Should have pertinent help message, got: %s", stdOut.toString()); assertAll(() -> assertTrue(t1, "Should have succeeded"), () -> assertEquals("", stdErr.toString(), "Should not have errors"), () -> assertTrue(stdOut.toString().contains("Create a new consent record"), errorMsg)); }
@Test final void onlyAllowsInOrOut() throws Exception { final boolean t1 = cli.run("consent", "create", "-p", "t2-mbi", "-d", "2019-11-22", "-i", "-o", "--host", "http: assertAll(() -> assertFalse(t1, "Should have failed"), () -> assertEquals("", stdOut.toString(), "Should not have output"), () -> assertNotEquals("", stdErr.toString(), "Should have errors"), () -> assertTrue(stdErr.toString().contains("argument -o/--out: not allowed with argument -i/--in"), "Should have '-o not allowed with -i' help message")); }
@Test final void detectsInvalidDate() throws Exception { final boolean t5 = cli.run("consent", "create", "-p", "tA-mbi", "-d", "Nov 22 2019", "-i", "--host", "http: assertAll(() -> assertFalse(t5, "Should have failed"), () -> assertEquals("", stdOut.toString(), "Should not have output"), () -> assertNotEquals("", stdErr.toString(), "Should have errors"), () -> assertTrue(stdErr.toString().contains("java.time.format.DateTimeParseException"), "Should have date parsing error")); }
@Test final void detectsInvalidUUID() throws Exception { final boolean t5 = cli.run("consent", "create", "-p", "tA-mbi", "-d", "2019-11-22", "-i", "--org", "1", "--host", "http: assertAll(() -> assertFalse(t5, "Should have failed"), () -> assertEquals("", stdOut.toString(), "Should not have output"), () -> assertNotEquals("", stdErr.toString(), "Should have errors"), () -> assertTrue(stdErr.toString().contains("java.lang.IllegalArgumentException"), "Should have date parsing error")); }
@Test final void createDefaultOptInRecord() throws Exception { final boolean t2 = cli.run("consent", "create", "-p", "t2-mbi", "-d", "2019-11-22", "-i", "--host", "http: assertAll(() -> assertTrue(t2, "Should have succeeded"), () -> assertEquals("", stdErr.toString(), "Should not have errors")); }
@Test final void createDefaultOptOutRecord() throws Exception { final boolean t3 = cli.run("consent", "create", "-p", "t3-mbi", "-d", "2019-11-23", "-o", "--host", "http: assertAll(() -> assertTrue(t3, "Should have succeeded"), () -> assertEquals("", stdErr.toString(), "Should not have errors")); }
@Test final void createExternalOrgRecord() throws Exception { final boolean t4 = cli.run("consent", "create", "-p", "t4-mbi", "-d", "2019-11-24", "-i", "--org", "46ac7ad6-7487-4dd0-baa0-6e2c8cae76a0", "--host", "http: assertAll(() -> assertTrue(t4, "Should have succeeded"), () -> assertEquals("", stdErr.toString(), "Should not have errors")); }