Search in sources :

Example 1 with SpecificDataPointsSupplier

use of org.junit.experimental.theories.internal.SpecificDataPointsSupplier 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 2 with SpecificDataPointsSupplier

use of org.junit.experimental.theories.internal.SpecificDataPointsSupplier 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 3 with SpecificDataPointsSupplier

use of org.junit.experimental.theories.internal.SpecificDataPointsSupplier 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 4 with SpecificDataPointsSupplier

use of org.junit.experimental.theories.internal.SpecificDataPointsSupplier 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 5 with SpecificDataPointsSupplier

use of org.junit.experimental.theories.internal.SpecificDataPointsSupplier 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

Test (org.junit.Test)6 PotentialAssignment (org.junit.experimental.theories.PotentialAssignment)6 SpecificDataPointsSupplier (org.junit.experimental.theories.internal.SpecificDataPointsSupplier)6 TestClass (org.junit.runners.model.TestClass)6