Search in sources :

Example 6 with TestClass

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

the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithAfter.

@Test
public void errorIsAddedWhenCategoryIsUsedWithAfter() {
    FrameworkMethod method = new TestClass(CategoryTest.class).getAnnotatedMethods(After.class).get(0);
    testAndAssertErrorMessage(method, "@After can not be combined with @Category");
}
Also used : After(org.junit.After) TestClass(org.junit.runners.model.TestClass) FrameworkMethod(org.junit.runners.model.FrameworkMethod) Test(org.junit.Test)

Example 7 with TestClass

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

the class SpecificDataPointsSupplierTest method shouldReturnOnlyTheNamedSingleMethodDataPoints.

@Test
public void shouldReturnOnlyTheNamedSingleMethodDataPoints() throws Throwable {
    SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class));
    List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingNamedSingleMethodString"));
    List<String> assignedStrings = getStringValuesFromAssignments(assignments);
    assertEquals(1, assignedStrings.size());
    assertThat(assignedStrings, hasItem("named single method 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 8 with TestClass

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

the class SpecificDataPointsSupplierTest method shouldReturnNothingIfTheNamedDataPointsAreMissing.

@Test
public void shouldReturnNothingIfTheNamedDataPointsAreMissing() throws Throwable {
    SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class));
    List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingWrongNamedString"));
    List<String> assignedStrings = getStringValuesFromAssignments(assignments);
    assertEquals(0, assignedStrings.size());
}
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 9 with TestClass

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

the class SpecificDataPointsSupplierTest method shouldReturnOnlyTheNamedFieldDataPoints.

@Test
public void shouldReturnOnlyTheNamedFieldDataPoints() throws Throwable {
    SpecificDataPointsSupplier supplier = new SpecificDataPointsSupplier(new TestClass(TestClassWithNamedDataPoints.class));
    List<PotentialAssignment> assignments = supplier.getValueSources(signature("methodWantingNamedFieldString"));
    List<String> assignedStrings = getStringValuesFromAssignments(assignments);
    assertEquals(1, assignedStrings.size());
    assertThat(assignedStrings, hasItem("named field"));
}
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 10 with TestClass

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

the class TestWithParametersTest method isEqualToTestWithSameNameAndTestClassAndParameters.

@Test
public void isEqualToTestWithSameNameAndTestClassAndParameters() {
    TestWithParameters firstTest = new TestWithParameters(DUMMY_NAME, new TestClass(DummyClass.class), Arrays.<Object>asList("a", "b"));
    TestWithParameters secondTest = new TestWithParameters(DUMMY_NAME, new TestClass(DummyClass.class), Arrays.<Object>asList("a", "b"));
    assertEquals(firstTest, secondTest);
}
Also used : TestClass(org.junit.runners.model.TestClass) 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