@Test
public void it_should_not_throw_exception_if_scripts_does_not_exist() throws Exception {
T mojo = createMojo("mojo-without-scripts", false);
writePrivate(mojo, "failOnMissingScript", false);
CommandResult result = createResult(false);
CommandExecutor executor = readPrivate(mojo, "executor");
ArgumentCaptor<Command> cmdCaptor = ArgumentCaptor.forClass(Command.class);
when(executor.execute(any(File.class), cmdCaptor.capture(), any(NpmLogger.class))).thenReturn(result);
mojo.execute();
VerificationMode verificationModeLog = isStandardScript() ? never() : times(1);
VerificationMode verificationModeExecutor = isStandardScript() ? times(1) : never();
Log logger = readPrivate(mojo, "log");
verify(logger, verificationModeLog).warn("Cannot execute npm run " + script() + " command: it is not defined in package.json, skipping.");
verify(logger, never()).error("Cannot execute npm run " + script() + " command: it is not defined in package.json.");
verify(executor, verificationModeExecutor).execute(any(File.class), any(Command.class), any(NpmLogger.class));
}
AbstractNpmScriptMojoTest.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:node-maven-plugin
作者:
评论列表
文章目录