Search in sources :

Example 1 with MutuallyExclusiveArgsException

use of picocli.CommandLine.MutuallyExclusiveArgsException in project neo4j by neo4j.

the class CheckConsistencyCommandIT method databaseAndBackupAreMutuallyExclusive.

@Test
void databaseAndBackupAreMutuallyExclusive() throws Exception {
    ConsistencyCheckService consistencyCheckService = mock(ConsistencyCheckService.class);
    CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(new ExecutionContext(homeDir, confPath), consistencyCheckService);
    when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(ConsistencyFlags.class))).thenReturn(ConsistencyCheckService.Result.success(null, null));
    MutuallyExclusiveArgsException incorrectUsage = assertThrows(MutuallyExclusiveArgsException.class, () -> {
        CommandLine.populateCommand(checkConsistencyCommand, "--database=foo", "--backup=bar");
        checkConsistencyCommand.execute();
    });
    assertThat(incorrectUsage.getMessage()).contains("--database=<database>, --backup=<path> are mutually exclusive (specify only one)");
}
Also used : MutuallyExclusiveArgsException(picocli.CommandLine.MutuallyExclusiveArgsException) ExecutionContext(org.neo4j.cli.ExecutionContext) ConsistencyFlags(org.neo4j.consistency.checking.full.ConsistencyFlags) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) CheckConsistencyCommand(org.neo4j.consistency.CheckConsistencyCommand) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 ExecutionContext (org.neo4j.cli.ExecutionContext)1 CheckConsistencyCommand (org.neo4j.consistency.CheckConsistencyCommand)1 ConsistencyCheckService (org.neo4j.consistency.ConsistencyCheckService)1 ConsistencyFlags (org.neo4j.consistency.checking.full.ConsistencyFlags)1 MutuallyExclusiveArgsException (picocli.CommandLine.MutuallyExclusiveArgsException)1