Skip to content

Commit

Permalink
renamed TestFormatter => TestNameFormatter
Browse files Browse the repository at this point in the history
  • Loading branch information
aaschmid committed Aug 9, 2014
1 parent 2ef2b03 commit 55a7982
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.junit.runners.model.FrameworkMethod;

import com.tngtech.java.junit.dataprovider.internal.TestFormatter;
import com.tngtech.java.junit.dataprovider.internal.TestNameFormatter;

/**
* A special framework method that allows the usage of parameters for the test method.
Expand All @@ -31,7 +31,7 @@ public class DataProviderFrameworkMethod extends FrameworkMethod {
/**
* Formatter for this test method.
*/
private TestFormatter testFormatter;
private TestNameFormatter testNameFormatter;


public DataProviderFrameworkMethod(Method method, int idx, Object[] parameters) {
Expand All @@ -46,12 +46,12 @@ public DataProviderFrameworkMethod(Method method, int idx, Object[] parameters)

this.idx = idx;
this.parameters = Arrays.copyOf(parameters, parameters.length);
this.testFormatter = new TestFormatter(); // set default testFormatter
this.testNameFormatter = new TestNameFormatter(); // set default testNameFormatter
}

@Override
public String getName() {
return testFormatter.format(getMethod(), idx, parameters);
return testNameFormatter.format(getMethod(), idx, parameters);
}

@Override
Expand Down Expand Up @@ -90,12 +90,12 @@ public boolean equals(Object obj) {
}

/**
* Parameters formatter to format parameters of the test method.
* Test name formatter to generate a the {@link String} representation of the test method.
* <p>
* This method exists and is package private (= visible) only for testing.
* </p>
*/
void setFormatter(TestFormatter testFormatter) {
this.testFormatter = testFormatter;
void setTestNameFormatter(TestNameFormatter testNameFormatter) {
this.testNameFormatter = testNameFormatter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.lang.reflect.Method;
import java.util.Arrays;

public class TestFormatter {
public class TestNameFormatter {

/**
* Returns a {@link String} representation of the given {@code method}, {@code idx} and {@code parameters}. The
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;

import com.tngtech.java.junit.dataprovider.internal.TestFormatter;
import com.tngtech.java.junit.dataprovider.internal.TestNameFormatter;

@RunWith(MockitoJUnitRunner.class)
public class DataProviderFrameworkMethodTest extends BaseTest {

@Mock
private TestFormatter formatter;
private TestNameFormatter formatter;

private final Method method = anyMethod();

Expand Down Expand Up @@ -65,7 +65,7 @@ public void testGetNameShouldReturnStringContainingMethodNameAndCallParametersFo
final Object[] parameters = new Object[] { 718, "718" };

DataProviderFrameworkMethod underTest = new DataProviderFrameworkMethod(method, 20, parameters);
underTest.setFormatter(formatter);
underTest.setTestNameFormatter(formatter);
doReturn("test").when(formatter).format(method, 20, parameters);

// When:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import com.tngtech.java.junit.dataprovider.BaseTest;

@RunWith(MockitoJUnitRunner.class)
public class TestFormatterTest extends BaseTest {
public class TestNameFormatterTest extends BaseTest {

@InjectMocks
private TestFormatter underTest;
private TestNameFormatter underTest;

@Test
public void testGetNameShouldHandleSingleValueCorrectly() {
Expand Down

0 comments on commit 55a7982

Please sign in to comment.