@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 exceptionIsThrownIfTheBladeAlreadyExists() throws Exception { given(blade).hasBeenCreated(); when(brjs).runCommand("create-blade", "app", "bladeset", "blade"); then(exceptions) .verifyException( NodeAlreadyExistsException.class, "blade", unquoted(blade.getClass().getSimpleName())) .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()); }
public void emptyFolderIsCreatedIfTemplateForImplicitlyPopulatedTemplateDoesNotExist() throws Exception { given(bladeset).hasBeenCreated().and(angularTemplates).templateGroupCreated(); when(brjs).runCommand("create-app", "app", "--template", "angular"); then(blade).hasDir("test-unit").and(blade.file("test-unit")).isEmpty(); }