Search in sources :

Example 71 with Description

use of org.junit.runner.Description in project junit-dataprovider by TNG.

the class DataProviderFilterTest method testShouldRunShouldReturnFalseWhenDescriptionHavingSomeRandomCodeBetweenMethodNameAndClassButClassIsNotTheSame.

@Test
public void testShouldRunShouldReturnFalseWhenDescriptionHavingSomeRandomCodeBetweenMethodNameAndClassButClassIsNotTheSame() {
    // Given:
    doReturn("Method testMain(com.tngtech.Clazz)").when(filter).describe();
    Description description = setupDescription(true, "testMain 8zBZ=(qzt)487(com.tngtech.OtherClazz)");
    // When:
    boolean result = underTest.shouldRun(description);
    // Then:
    assertThat(result).isFalse();
}
Also used : Description(org.junit.runner.Description) Test(org.junit.Test)

Example 72 with Description

use of org.junit.runner.Description in project junit-dataprovider by TNG.

the class DataProviderFilterTest method testShouldRunShouldReturnTrueWhenDescriptionHaveAdditionalMethodIdxAndEqualsMethodNameAndClass.

@Test
public void testShouldRunShouldReturnTrueWhenDescriptionHaveAdditionalMethodIdxAndEqualsMethodNameAndClass() {
    // Given:
    doReturn("Method testMain(com.tngtech.Clazz)").when(filter).describe();
    Description description = setupDescription(true, "testMain[1: ](com.tngtech.Clazz)");
    // When:
    boolean result = underTest.shouldRun(description);
    // Then:
    assertThat(result).isTrue();
}
Also used : Description(org.junit.runner.Description) Test(org.junit.Test)

Example 73 with Description

use of org.junit.runner.Description in project junit-dataprovider by TNG.

the class DataProviderFilterTest method testShouldRunShouldReturnTrueForMatchingChildDescription.

@Test
public void testShouldRunShouldReturnTrueForMatchingChildDescription() {
    // Given:
    doReturn("Method testMain[1: ](com.tngtech.Clazz)").when(filter).describe();
    Description description = setupDescription(false, "", setupDescription(true, "testMain[1: ](com.tngtech.Clazz)"));
    // When:
    boolean result = underTest.shouldRun(description);
    // Then:
    assertThat(result).isTrue();
}
Also used : Description(org.junit.runner.Description) Test(org.junit.Test)

Example 74 with Description

use of org.junit.runner.Description in project junit-dataprovider by TNG.

the class DataProviderFilterTest method testShouldRunShouldReturnFalseWhenDescriptionDoesNotHaveExpectedMethodName.

@Test
public void testShouldRunShouldReturnFalseWhenDescriptionDoesNotHaveExpectedMethodName() {
    // Given:
    doReturn("Method testMain[1: ](com.tngtech.Clazz)").when(filter).describe();
    Description description = setupDescription(true, "testOther[1: ](com.tngtech.Clazz)");
    // When:
    boolean result = underTest.shouldRun(description);
    // Then:
    assertThat(result).isFalse();
}
Also used : Description(org.junit.runner.Description) Test(org.junit.Test)

Example 75 with Description

use of org.junit.runner.Description in project junit-dataprovider by TNG.

the class DataProviderFilterTest method testShouldRunShouldReturnTrueWhenDescriptionHaveAddtionalMethodIdxAndEqualsExcatly.

@Test
public void testShouldRunShouldReturnTrueWhenDescriptionHaveAddtionalMethodIdxAndEqualsExcatly() {
    // Given:
    doReturn("Method testMain[1: ](com.tngtech.Clazz)").when(filter).describe();
    Description description = setupDescription(true, "testMain[1: ](com.tngtech.Clazz)");
    // When:
    boolean result = underTest.shouldRun(description);
    // Then:
    assertThat(result).isTrue();
}
Also used : Description(org.junit.runner.Description) Test(org.junit.Test)

Aggregations

Description (org.junit.runner.Description)309 Test (org.junit.Test)119 Failure (org.junit.runner.notification.Failure)57 Result (org.junit.runner.Result)32 ArrayList (java.util.ArrayList)25 RunListener (org.junit.runner.notification.RunListener)23 IOException (java.io.IOException)22 Request (org.junit.runner.Request)21 Method (java.lang.reflect.Method)18 JUnitCore (org.junit.runner.JUnitCore)17 Test (org.junit.jupiter.api.Test)14 Filter (org.junit.runner.manipulation.Filter)14 File (java.io.File)13 Runner (org.junit.runner.Runner)13 Statement (org.junit.runners.model.Statement)13 LoggingListener (org.elasticsearch.test.junit.listeners.LoggingListener)12 RunNotifier (org.junit.runner.notification.RunNotifier)12 JUnit4TestListener (com.intellij.junit4.JUnit4TestListener)10 ComparisonFailure (org.junit.ComparisonFailure)10 Description.createTestDescription (org.junit.runner.Description.createTestDescription)9