@Test public void exceptionIsThrownIfBladeNameIsInvalid() throws Exception { given(bladeset) .hasBeenCreated() .and(defaultTemplates) .templateGroupCreated() .and(logging) .enabled(); when(brjs).runCommand("create-blade", "app", "bladeset", "!$%$^"); then(logging) .errorMessageReceived(NODE_CREATION_FAILED_LOG_MSG, "Blade", badBlade.dir().getPath()) .and(exceptions) .verifyException(InvalidDirectoryNameException.class, "!$%$^", badBlade.dir().getPath()) .whereTopLevelExceptionIs(CommandArgumentsException.class) .and(logging) .otherMessagesIgnored(); }
@Test public void bladeIsCreatedWhenAllArgumentsAreValid() throws Exception { given(bladeset).hasBeenCreated().and(defaultTemplates).templateGroupCreated(); when(brjs).runCommand("create-blade", "app", "bladeset", "blade"); then(blade) .dirExists() .and(logging) .containsFormattedConsoleMessage(BLADE_CREATE_SUCCESS_CONSOLE_MSG, "blade") .and(logging) .containsFormattedConsoleMessage(BLADE_PATH_CONSOLE_MSG, blade.dir().getPath()); }
@Test public void bladeIsCreatedInTheDefaultBladesetIfBladesetNotSpecified() throws Exception { given(bladeset).hasBeenCreated().and(defaultTemplates).templateGroupCreated(); when(brjs).runCommand("create-blade", "app", "default", "blade1"); then(blade1InDefaultBladeset) .dirExists() .and(logging) .containsFormattedConsoleMessage(BLADE_CREATE_SUCCESS_CONSOLE_MSG, "blade1") .and(logging) .containsFormattedConsoleMessage( BLADE_PATH_CONSOLE_MSG, blade1InDefaultBladeset.dir().getPath()); }