@@ -127,6 +127,10 @@ public void unexpectedTemplate() {
127127 .append (System .lineSeparator ())
128128 .append ("───────────────────── ─────────────────────────────────────────────────────────────────────────────" )
129129 .append (System .lineSeparator ())
130+ .append ("bad-include-path Template with incorrect include path. Should throw error." )
131+ .append (System .lineSeparator ())
132+ .append ("bad-template-path Template with incorrect path. Should throw error." )
133+ .append (System .lineSeparator ())
130134 .append ("included-file-json Smithy Quickstart example with json file included." )
131135 .append (System .lineSeparator ())
132136 .append ("included-files-gradle Smithy Quickstart example with gradle files included." )
@@ -199,6 +203,10 @@ public void withListArg() {
199203 .append (System .lineSeparator ())
200204 .append ("───────────────────── ─────────────────────────────────────────────────────────────────────────────" )
201205 .append (System .lineSeparator ())
206+ .append ("bad-include-path Template with incorrect include path. Should throw error." )
207+ .append (System .lineSeparator ())
208+ .append ("bad-template-path Template with incorrect path. Should throw error." )
209+ .append (System .lineSeparator ())
202210 .append ("included-file-json Smithy Quickstart example with json file included." )
203211 .append (System .lineSeparator ())
204212 .append ("included-files-gradle Smithy Quickstart example with gradle files included." )
@@ -253,6 +261,40 @@ public void executesInitSuccessQuiet() {
253261 });
254262 }
255263
264+ @ Test
265+ public void badTemplatePathFailureExpected () {
266+ IntegUtils .withProject (PROJECT_NAME , templatesDir -> {
267+ setupTemplatesDirectory (templatesDir );
268+
269+ IntegUtils .withTempDir ("badTemplatePath" , dir -> {
270+ RunResult result = IntegUtils .run (
271+ dir , ListUtils .of ("init" , "-t" , "bad-template-path" , "-u" , templatesDir .toString ()));
272+ assertThat (Files .exists (Paths .get (dir .toString (), "bad-template-path" )), is (false ));
273+ assertThat (result .getExitCode (), is (1 ));
274+ assertThat (result .getOutput (),
275+ containsString ("Template path `getting-started-example/does-not-exist` for template"
276+ +" \" bad-template-path\" is invalid." ));
277+ });
278+ });
279+ }
280+
281+ @ Test
282+ public void badIncludePathFailureExpected () {
283+ IntegUtils .withProject (PROJECT_NAME , templatesDir -> {
284+ setupTemplatesDirectory (templatesDir );
285+
286+ IntegUtils .withTempDir ("badIncludePath" , dir -> {
287+ RunResult result = IntegUtils .run (
288+ dir , ListUtils .of ("init" , "-t" , "bad-include-path" , "-u" , templatesDir .toString ()));
289+ assertThat (Files .exists (Paths .get (dir .toString (), " bad-include-path" )), is (false ));
290+ assertThat (result .getExitCode (), is (1 ));
291+ assertThat (result .getOutput (),
292+ containsString ("File or directory `getting-started-example/does-not-exist` is marked"
293+ + " for inclusion in template \" bad-include-path\" , but was not found" ));
294+ });
295+ });
296+ }
297+
256298 private static void run (List <String > args , Path root ) {
257299 StringBuilder output = new StringBuilder ();
258300 int result = IoUtils .runCommand (args , root , output , Collections .emptyMap ());
0 commit comments