From 362b3afcc71da8297143a58c8afb781f8d71fd4f Mon Sep 17 00:00:00 2001 From: Madhavan Sridharan Date: Fri, 26 Apr 2024 13:34:28 -0400 Subject: [PATCH] Unit test for using non-existent driver --- .../io/nosqlbench/engine/cli/NBCLITest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nb-engine/nb-engine-cli/src/test/java/io/nosqlbench/engine/cli/NBCLITest.java diff --git a/nb-engine/nb-engine-cli/src/test/java/io/nosqlbench/engine/cli/NBCLITest.java b/nb-engine/nb-engine-cli/src/test/java/io/nosqlbench/engine/cli/NBCLITest.java new file mode 100644 index 000000000..405a41308 --- /dev/null +++ b/nb-engine/nb-engine-cli/src/test/java/io/nosqlbench/engine/cli/NBCLITest.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2020-2024 nosqlbench + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.nosqlbench.engine.cli; + +import io.nosqlbench.nb.api.errors.BasicError; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType; + +public class NBCLITest { + + @Test + public void testNonExistentDriverThrowsError() { + assertThatExceptionOfType(BasicError.class) + .isThrownBy(() -> new NBCLI("run driver=nonexistent --show-stacktraces")) + .withMessageContaining("Unable to load default driver adapter 'nonexistent'"); + } +} +