Permalink
Browse files

Added README and also changed file names for test to CharaterizationT…

…ests to meet the convention from Michael Feathers
  • Loading branch information...
1 parent 04b95ef commit de72de5c413ede656e1d14e7656f13d6254f86b3 @peterrhysthomas peterrhysthomas committed Sep 10, 2012
@@ -0,0 +1,3 @@
+## Solution from [@peterrhysthomas](https://twitter.com/peterrhysthomas)
+
+Note - this solution uses the [characterization testing](http://en.wikipedia.org/wiki/Characterization_test) approach for placing the code under test before implementing any refactoring of the solution. These tests act as a regression to ensure that the existing behaviour is maintained through the subsequent refactoring and unit testing cycle. Characterization tests are based on the existing inputs and outputs of the code and it makes no attempt to check the validity of these, it assumes that the existing behaviour is the desired behaviour.
@@ -3,10 +3,13 @@
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
-
-public class TelemetryDiagnosticControlsCoveringsTests{
+/**
+ * Characterization test class for testing existing behaviour of
+ * {@link TelemetryDiagnosticControls} before refactoring.
+ *
+ */
+public class TelemetryDiagnosticControlsCharacterizationTests{
@Test
- // Regression test to ensure existing API is not broken
public void checkTransmissionShouldSetDiagnosticInfo() throws Exception{
TelemetryDiagnosticControls controls = new TelemetryDiagnosticControls();
@@ -6,10 +6,14 @@
import org.junit.Test;
-public class UnicodeFileToHtmlTextConverterCoveringsTests {
+/**
+ * Characterization test class for testing existing behaviour of
+ * {@link UnicodeFileToHtmlTextConverter} before refactoring.
+ *
+ */
+public class UnicodeFileToHtmlTextConverterCharacterizationTests {
@Test
- // Regression test to ensure existing API is not broken
public void shouldConvertFileContentsToHtmlEscapedString() throws IOException {
String fullFilenameWithPath = this.getClass().getClassLoader().getResource("data.txt").getPath();
UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter(fullFilenameWithPath);
@@ -4,11 +4,14 @@
import org.junit.Test;
-
-public class TurnTicketDispenserCoveringsTests {
+/**
+ * Characterization test class for testing existing behaviour of
+ * {@link TicketDispenser} before refactoring.
+ *
+ */
+public class TurnTicketDispenserCharacterizationTests {
@Test
- // Regression test to ensure existing API is not broken
public void returnsAnIncrementingSequenceOfTicketsUsingDefaultSequenceImplementation() {
TicketDispenser dispenser = new TicketDispenser();
assertEquals(0,dispenser.getTurnTicket().getTurnNumber());

0 comments on commit de72de5

Please sign in to comment.