当前位置: 首页>>代码示例>>Java>>正文


Java CommandLineArgumentBuilder类代码示例

本文整理汇总了Java中com.sandwich.koan.cmdline.CommandLineArgumentBuilder的典型用法代码示例。如果您正苦于以下问题:Java CommandLineArgumentBuilder类的具体用法?Java CommandLineArgumentBuilder怎么用?Java CommandLineArgumentBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandLineArgumentBuilder类属于com.sandwich.koan.cmdline包,在下文中一共展示了CommandLineArgumentBuilder类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWarningFromPlacingExpecationOnWrongSide

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void testWarningFromPlacingExpecationOnWrongSide() throws Throwable {
	final String[] message = new String[1];
	stubAllKoans(Arrays.asList(new WrongExpectationOrderKoan()));
	Logger.getLogger(CommandLineArgumentRunner.class.getSimpleName()).addHandler(
			new Handler() {
				@Override
				public void close() throws SecurityException {
				}

				@Override
				public void flush() {
				}

				@Override
				public void publish(LogRecord arg0) {
					message[0] = arg0.getMessage();
				}
			});
	new CommandLineArgumentRunner(new CommandLineArgumentBuilder()).run();
	assertEquals(
			new StringBuilder(
					WrongExpectationOrderKoan.class.getSimpleName())
					.append(".expectationOnLeft ")
					.append(EXPECTATION_LEFT_ARG).toString(), message[0]);
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:27,代码来源:AppReadinessForDeploymentTest.java

示例2: testWarningFromPlacingExpectationOnWrongSide

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void testWarningFromPlacingExpectationOnWrongSide() throws Throwable {
	final String[] message = new String[1];
	stubAllKoans(Arrays.asList(new WrongExpectationOrderKoan()));
	Logger.getLogger(CommandLineArgumentRunner.class.getSimpleName()).addHandler(
			new Handler() {
				@Override
				public void close() throws SecurityException {
				}

				@Override
				public void flush() {
				}

				@Override
				public void publish(LogRecord arg0) {
					message[0] = arg0.getMessage();
				}
			});
	new CommandLineArgumentRunner(new CommandLineArgumentBuilder()).run();
	assertEquals(
			new StringBuilder(
					WrongExpectationOrderKoan.class.getSimpleName())
					.append(".expectationOnLeft ")
					.append(EXPECTATION_LEFT_ARG).toString(), message[0]);
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:27,代码来源:AppReadinessForDeploymentTest.java

示例3: hintPresentation

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void hintPresentation() throws Throwable {
	stubAllKoans(Arrays.asList(new OneFailingKoanDifferentName()));
	new CommandLineArgumentRunner(new CommandLineArgumentBuilder()).run();
	assertSystemOutContains(new StringBuilder(
			INVESTIGATE_IN_THE).append(
			" ").append(
			OneFailingKoanDifferentName.class.getSimpleName()).append(
			" class's ").append(
			OneFailingKoanDifferentName.class.getDeclaredMethod("koanMethod").getName()).append(
			" method.").toString());
	assertSystemOutContains("Line 11 may offer a clue as to how you may progress, now make haste!");
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:14,代码来源:ConsolePresenterTest.java

示例4: testNecessityOfAddingRunKoansCommandLineArgument_doesntIfClassArgIsntPresent

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void testNecessityOfAddingRunKoansCommandLineArgument_doesntIfClassArgIsntPresent(){
	List<ArgumentType> types = new ArrayList<ArgumentType>(Arrays.asList(ArgumentType.values()));
	assertTrue(types.remove(ArgumentType.CLASS_ARG));
	assertTrue(types.remove(ArgumentType.DEBUG));
	assertTrue(types.remove(ArgumentType.RUN_KOANS));
	for(ArgumentType type : types){
		Map<ArgumentType, CommandLineArgument> args = new CommandLineArgumentBuilder(type.args().iterator().next());
		assertArgsContains(false, args, ArgumentType.RUN_KOANS);
		assertArgsContains(true, args, type);
	}
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:13,代码来源:AppLauncherTest.java

示例5: hintPresentation

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void hintPresentation() throws Throwable {
	stubAllKoans(Arrays.asList(new OneFailingKoanDifferentName()));
	new CommandLineArgumentRunner(new CommandLineArgumentBuilder()).run();
	assertSystemOutContains(new StringBuilder(
			Strings.getMessage("investigate")).append(
			": ").append(
			OneFailingKoanDifferentName.class.getSimpleName()).append(
			" class's ").append(
			OneFailingKoanDifferentName.class.getDeclaredMethod("koanMethod").getName()).append(
			" method.").toString());
	assertSystemOutContains("Line 11 may offer a clue as to how you may progress, now make haste!");
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:14,代码来源:ConsolePresenterTest.java

示例6: main

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
public static void main(final String... args) throws Throwable {
	Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(args);
	if(argsMap.containsKey(ArgumentType.RUN_KOANS)){
		new Thread(new Runnable(){ 
			public void run() {
				do{
					try {
						char c = (char)System.in.read();
						if(Character.toUpperCase(c) == 
								Character.toUpperCase(ApplicationSettings.getExitChar())){
							FileMonitorFactory.closeAll();
							System.exit(0);
						}
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				}while(true);
			}
		}).start();
		FileMonitor monitor = FileMonitorFactory.getInstance(
				new File(DirectoryManager.getProdMainDir()), 
				new File(DirectoryManager.getDataFile()));
		if(ApplicationUtils.isFirstTimeAppHasBeenRun()){
			monitor.writeChanges();
		}
		monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
	}
	new CommandLineArgumentRunner(argsMap).run();
	if(ApplicationSettings.isDebug()){
		StringBuilder argsBuilder = new StringBuilder();
		int argNumber = 0;
		for(String arg : args){
			argsBuilder.append("Argument number "+String.valueOf(++argNumber)+": '"+arg+"'");
		}
		ApplicationUtils.getPresenter().displayMessage(argsBuilder.toString());
	}
}
 
开发者ID:MarinaMurashev,项目名称:JavaKoans,代码行数:38,代码来源:AppLauncher.java

示例7: testNecessityOfAddingRunKoansCommandLineArgument_addsIfNoArgsPresent

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void testNecessityOfAddingRunKoansCommandLineArgument_addsIfNoArgsPresent(){ //default target
	Map<ArgumentType, CommandLineArgument> args = new CommandLineArgumentBuilder();
	assertArgsContains(true, args, ArgumentType.RUN_KOANS);
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:6,代码来源:AppLauncherTest.java

示例8: testNecessityOfAddingRunKoansCommandLineArgument_ifClassArgIsPresent

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
@Test
public void testNecessityOfAddingRunKoansCommandLineArgument_ifClassArgIsPresent(){
	Map<ArgumentType, CommandLineArgument> args = new CommandLineArgumentBuilder(Object.class.getName());
	assertArgsContains(true, args, ArgumentType.RUN_KOANS, ArgumentType.CLASS_ARG);
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:6,代码来源:AppLauncherTest.java

示例9: main

import com.sandwich.koan.cmdline.CommandLineArgumentBuilder; //导入依赖的package包/类
public static void main(final String... args) throws Throwable {
    Map<ArgumentType, CommandLineArgument> argsMap = new CommandLineArgumentBuilder(
            args);
    if (argsMap.containsKey(ArgumentType.RUN_KOANS)) {
        if (ApplicationSettings.isInteractive()) {
            new Thread(new Runnable() {
                public void run() {
                    do {
                        try {
                            char c = (char) System.in.read();
                            char exitChar = ApplicationSettings.getExitChar();
                            if (Character.toUpperCase(c) == Character.toUpperCase(exitChar)) {
                                exit(0);
                            }
                        } catch (IOException e) {
                            throw new RuntimeException(e);
                        }
                    } while (true);
                }

            }).start();
            FileMonitor monitor = FileMonitorFactory.getInstance(new File(
                    DirectoryManager.getProdMainDir()), new File(
                    DirectoryManager.getDataFile()));
            if (ApplicationUtils.isFirstTimeAppHasBeenRun()) {
                monitor.writeChanges();
            }
            monitor.addFileSavedListener(new KoanFileCompileAndRunListener(argsMap));
        }
    }
    new CommandLineArgumentRunner(argsMap).run();
    if (ApplicationSettings.isDebug()) {
        StringBuilder argsBuilder = new StringBuilder();
        int argNumber = 0;
        for (String arg : args) {
            argsBuilder.append("Argument number "
                    + String.valueOf(++argNumber) + ": '" + arg + "'");
        }
        ApplicationUtils.getPresenter().displayMessage(
                argsBuilder.toString());
    }
}
 
开发者ID:nkalupahana,项目名称:completed-koans,代码行数:43,代码来源:AppLauncher.java


注:本文中的com.sandwich.koan.cmdline.CommandLineArgumentBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。