Esempio n. 1
0
  @Test
  public void testBootstrap() {

    String[] args = new String[] {"-param1", "a1", "-param2", "a2", "-param3", "1"};
    Bootstrap bootstrap = new Bootstrap();
    bootstrap.parseAndContinue(args);

    ConfigurableBean cb = bootstrap.getMainContext().getBean(ConfigurableBean.class);
    assertEquals("a1", cb.getParamOne());
    assertEquals("a2", cb.getParamTwo());
    assertEquals(1, cb.getParamThree());
  }
Esempio n. 2
0
  @Test
  public void testBootstrapNoCommandLine() {

    String[] args = new String[] {};
    Bootstrap bootstrap = new Bootstrap();
    bootstrap.parseAndContinue(args);

    ConfigurableBean cb = bootstrap.getMainContext().getBean(ConfigurableBean.class);
    assertEquals("oneparam", cb.getParamOne());
    assertEquals("twoparam", cb.getParamTwo());
    assertEquals(123, cb.getParamThree());
  }