Examples of JUnitTest


Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

  public void shouldWriterPropertiesAsAttributes() {
    Properties properties = new Properties();
    properties.setProperty("key1", "value1");
    properties.setProperty("key2", "value2");
    final JUnitTest suite = new JUnitTest("Hello");
    suite.setProperties(properties);
    final XmlNode propertiesNode = mockXmlNode();
    new EasyMockTemplate(targetNode, propertiesNode) {
      @Override protected void expectations() throws Exception {
        expect(targetNode.addNewNode(PROPERTIES)).andReturn(propertiesNode);
        XmlAttributes attributes1 = attributes(name(ATTR_NAME).value("key1"), name(ATTR_VALUE).value("value1"));
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

      }
    }.run();
  }

  public void shouldNotAddPropertiesIfPropertiesIsNull() {
    final JUnitTest suite = new JUnitTest("Hello");
    assertThat(suite.getProperties()).isNull();
    final XmlNode propertiesNode = mockXmlNode();
    new EasyMockTemplate(targetNode, propertiesNode) {
      @Override protected void expectations() throws Exception {
        expect(targetNode.addNewNode(PROPERTIES)).andReturn(propertiesNode);
      }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

      }
    }.run();
  }

  public void shouldNotAddPropertiesIfPropertiesIsEmpty() {
    final JUnitTest suite = new JUnitTest("Hello");
    suite.setProperties(new Properties());
    assertThat(suite.getProperties()).isEmpty();
    final XmlNode propertiesNode = mockXmlNode();
    new EasyMockTemplate(targetNode, propertiesNode) {
      @Override protected void expectations() throws Exception {
        expect(targetNode.addNewNode(PROPERTIES)).andReturn(propertiesNode);
      }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

  private XmlNode mockXmlNode() {
    return createMock(XmlNode.class);
  }

  public void shouldWriteStatisticsAsAttribute() {
    final JUnitTest suite = new JUnitTest("Hello");
    suite.setCounts(6l, 2l, 1l);
    suite.setRunTime(8000l);
    new EasyMockTemplate(targetNode) {
      @Override protected void expectations() {
        expectAttributeAdded(name(ATTR_TESTS).value(6l));
        expectAttributeAdded(name(ATTR_FAILURES).value(2l));
        expectAttributeAdded(name(ATTR_ERRORS).value(1l));
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

    assertThat(time).isGreaterThanOrEqualTo(0d);
    assertThatSuiteAndEnvironmentInfoWereAddedTo(root);
  }

  private JUnitTest startTestSuiteWithStatistics() {
    JUnitTest s = startSuite();
    s.setCounts(18, 8, 6);
    return s;
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

*/
public class SuiteXmlNodeWriter_writeSuiteName_Test extends SuiteXmlNodeWriter_TestCase {

  @Test
  public void should_write_suite_name_as_attribute() {
    final JUnitTest suite = new JUnitTest("Hello");
    new EasyMockTemplate(targetNode) {
      @Override protected void expectations() throws Exception {
        targetNode.addAttribute(name(ATTR_NAME).value("Hello"));
        expectLastCall().once();
      }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

    }.run();
  }

  @Test
  public void should_write_word_unknown_as_attribute_if_suite_does_not_have_name() {
    final JUnitTest suite = new JUnitTest(null);
    new EasyMockTemplate(targetNode) {
      @Override protected void expectations() throws Exception {
        targetNode.addAttribute(name(ATTR_NAME).value("unknown"));
      }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

  @Ignore("this test passes only when run individually")
  public void should_write_error_in_XML_document_if_ScreenshotWriter_could_not_be_created() {
    headlessAWT(true); // force an ImageException to be thrown
    try {
      formatter.startTestSuite(new JUnitTest());
      XmlNode root = formatter.xmlRootNode();
      assertThat(root.size()).isEqualTo(2);
      XmlNode errorNode = root.child(1);
      assertThat(errorNode.name()).isEqualTo("error");
    } finally {
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

*/
public class XmlJUnitResultFormatter_setSystemError_Test extends XmlJUnitResultFormatter_TestCase {

  @Test
  public void should_add_system_error() {
    formatter.startTestSuite(new JUnitTest("test"));
    formatter.setSystemError(CONSOLE_OUTPUT);
    XmlNode systemErrNode = root().child(1);
    assertThat(systemErrNode.name()).isEqualTo("system-err");
    assertThat(systemErrNode.text()).isEqualTo(CONSOLE_OUTPUT);
  }
View Full Code Here

Examples of org.apache.tools.ant.taskdefs.optional.junit.JUnitTest

  @Test
  public void shouldReturnTestClassNameFromVmExitErrorTest() {
    Class<?> vmExitErrorTestClass = staticInnerClass("VmExitErrorTest").in(JUnitTaskMirrorImpl.class).get();
    Object test = constructor().withParameterTypes(String.class, JUnitTest.class, String.class)
                               .in(vmExitErrorTestClass)
                               .newInstance("someMessage", new JUnitTest("testClassName"), "testName");
    assertThat(test).isInstanceOf(junit.framework.Test.class);
    assertThat(Tests.testClassNameFrom((junit.framework.Test)test)).isEqualTo("testClassName");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.