Ejemplo n.º 1
0
 @Test(expected = WebSuitesException.class)
 public void testArgumentErrorWrongArgumentCount() {
   sut.instantiateCommand(
       "sample simple value", // without tabs
       new String[] {},
       source());
   fail("command should not be craeted");
 }
Ejemplo n.º 2
0
  @Test
  public void testNoArgCommand() {

    Command command = sut.instantiateCommand("noArg", new String[] {}, source());

    assertNotNull(command);

    assertTrue(command instanceof NoArgCommand);
  }
Ejemplo n.º 3
0
 @Test
 public void shouldDetectCustomScanPathPackage() {
   // given
   WebSuitesConfig.initializeWebsuitesConfig(CustomPackageRunner.class);
   sut = new StandardCommandBuilder();
   // when
   Command command =
       sut.instantiateCommand("customUserCommand", new String[] {}, new SourceLine("", "", 0));
   // then
   assertThat(command).isInstanceOf(CustomCommandInClasspath.class);
 }
Ejemplo n.º 4
0
  @Test
  public void testSimpleCommand() {

    Command command = sut.instantiateCommand("sample", new String[] {"command argument"}, source());

    assertNotNull(command);

    assertTrue(command instanceof SampleCommand);

    assertEquals("command argument", Deencapsulation.getField(command, "arg"));
  }
Ejemplo n.º 5
0
  @Test
  public void testMultiArgCommand() {

    Command command =
        sut.instantiateCommand(
            "multiArg", new String[] {"string value", "5687", "true", "23"}, source());

    assertNotNull(command);

    assertTrue(command instanceof MultiArgCommand);

    assertEquals("string value", Deencapsulation.getField(command, "string"));
    assertEquals(5687, Deencapsulation.getField(command, "integer"));
    assertEquals(true, Deencapsulation.getField(command, "bool"));
    assertEquals((byte) 23, Deencapsulation.getField(command, "bytee"));
  }
Ejemplo n.º 6
0
 @Test(expected = WebSuitesException.class)
 public void testArgumentErrorToManyArguments() {
   sut.instantiateCommand("sample", new String[] {"param", "another not expected"}, source());
   fail("command should not be craeted");
 }