Search in sources :

Example 46 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class PublicClassValidatorTest method acceptsPublicClass.

@Test
public void acceptsPublicClass() {
    TestClass testClass = new TestClass(PublicClass.class);
    List<Exception> validationErrors = validator.validateTestClass(testClass);
    assertThat(validationErrors, is(equalTo(Collections.<Exception>emptyList())));
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 47 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class BlockJUnit4ClassRunnerWithParametersTest method hasAllAnnotationsExceptRunWith.

@Test
public void hasAllAnnotationsExceptRunWith() throws Exception {
    TestWithParameters testWithParameters = new TestWithParameters("dummy name", new TestClass(ClassWithParameterizedAnnotation.class), NO_PARAMETERS);
    BlockJUnit4ClassRunnerWithParameters runner = new BlockJUnit4ClassRunnerWithParameters(testWithParameters);
    Annotation[] annotations = runner.getRunnerAnnotations();
    assertEquals(1, annotations.length);
    assertEquals(annotations[0].annotationType(), DummyAnnotation.class);
}
Also used : TestClass(org.junit.runners.model.TestClass) Annotation(java.lang.annotation.Annotation) Test(org.junit.Test)

Example 48 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class TestWithParametersTest method hasMeaningfulToString.

@Test
public void hasMeaningfulToString() {
    TestWithParameters test = new TestWithParameters("name", new TestClass(DummyClass.class), Arrays.<Object>asList("first parameter", "second parameter"));
    assertEquals("Wrong toString().", "org.junit.runners.parameterized.TestWithParametersTest$DummyClass 'name' with parameters [first parameter, second parameter]", test.toString());
}
Also used : TestClass(org.junit.runners.model.TestClass) Test(org.junit.Test)

Example 49 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class SpecificDataPointsSupplierTest method shouldReturnOnlyTheNamedSingleFieldDataPoints.

@Test
public void shouldReturnOnlyTheNamedSingleFieldDataPoints() throws Throwable {
    SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class));
    List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingNamedSingleFieldString"));
    List<String> assignedStrings = getStringValuesFromAssignments(assignments);
    assertEquals(1, assignedStrings.size());
    assertThat(assignedStrings, hasItem("named single value"));
}
Also used : SpecificDataPointsSupplier(org.junit.experimental.theories.internal.SpecificDataPointsSupplier) TestClass(org.junit.runners.model.TestClass) PotentialAssignment(org.junit.experimental.theories.PotentialAssignment) Test(org.junit.Test)

Example 50 with TestClass

use of org.junit.runners.model.TestClass in project junit4 by junit-team.

the class SpecificDataPointsSupplierTest method shouldReturnOnlyTheNamedMethodDataPoints.

@Test
public void shouldReturnOnlyTheNamedMethodDataPoints() throws Throwable {
    SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class));
    List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingNamedMethodString"));
    List<String> assignedStrings = getStringValuesFromAssignments(assignments);
    assertEquals(1, assignedStrings.size());
    assertThat(assignedStrings, hasItem("named method"));
}
Also used : SpecificDataPointsSupplier(org.junit.experimental.theories.internal.SpecificDataPointsSupplier) TestClass(org.junit.runners.model.TestClass) PotentialAssignment(org.junit.experimental.theories.PotentialAssignment) Test(org.junit.Test)

Aggregations

TestClass (org.junit.runners.model.TestClass)60 Test (org.junit.Test)41 FrameworkMethod (org.junit.runners.model.FrameworkMethod)12 PotentialAssignment (org.junit.experimental.theories.PotentialAssignment)6 SpecificDataPointsSupplier (org.junit.experimental.theories.internal.SpecificDataPointsSupplier)6 Annotation (java.lang.annotation.Annotation)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 PluginClassLoader (com.intellij.ide.plugins.cl.PluginClassLoader)2 HashMap (java.util.HashMap)2 AfterClass (org.junit.AfterClass)2 BeforeClass (org.junit.BeforeClass)2 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)2 Interaction (au.com.dius.pact.model.Interaction)1 Pact (au.com.dius.pact.model.Pact)1 ConsumerInfo (au.com.dius.pact.provider.ConsumerInfo)1 ProviderInfo (au.com.dius.pact.provider.ProviderInfo)1 ProviderVerifier (au.com.dius.pact.provider.ProviderVerifier)1 Provider (au.com.dius.pact.provider.junit.Provider)1