Search in sources :

Example 1 with TestClass

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

the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithBefore.

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

Example 2 with TestClass

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

the class CategoryValidatorTest method errorIsAddedWhenCategoryIsUsedWithAfterClass.

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

Example 3 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 4 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 5 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)

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