88import static org .hamcrest .Matchers .*;
99import static org .junit .Assert .*;
1010
11- public class NucleotideTest {
11+ public class NucleotideCounterTest {
1212
1313 @ Rule
1414 public ExpectedException expectedException = ExpectedException .none ();
1515
1616 @ Test
1717 public void testEmptyDnaStringHasNoAdenine () {
18- DNA dna = new DNA ("" );
19- assertThat (dna .count ('A' ), is (0 ));
18+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("" );
19+ assertThat (nucleotideCounter .count ('A' ), is (0 ));
2020 }
2121
2222 @ Ignore ("Remove to run test" )
2323 @ Test
2424 public void testEmptyDnaStringHasNoNucleotides () {
25- DNA dna = new DNA ("" );
26- Map <Character , Integer > counts = dna .nucleotideCounts ();
25+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("" );
26+ Map <Character , Integer > counts = nucleotideCounter .nucleotideCounts ();
2727 assertThat (counts .size (), is (4 ));
2828 assertThat (counts , allOf (
2929 hasEntry ('A' , 0 ),
@@ -36,15 +36,15 @@ public void testEmptyDnaStringHasNoNucleotides() {
3636 @ Ignore ("Remove to run test" )
3737 @ Test
3838 public void testRepetitiveCytosineGetsCounted () {
39- DNA dna = new DNA ("CCCCC" );
40- assertThat (dna .count ('C' ), is (5 ));
39+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("CCCCC" );
40+ assertThat (nucleotideCounter .count ('C' ), is (5 ));
4141 }
4242
4343 @ Ignore ("Remove to run test" )
4444 @ Test
4545 public void testRepetitiveSequenceWithOnlyGuanine () {
46- DNA dna = new DNA ("GGGGGGGG" );
47- Map <Character , Integer > counts = dna .nucleotideCounts ();
46+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("GGGGGGGG" );
47+ Map <Character , Integer > counts = nucleotideCounter .nucleotideCounts ();
4848 assertThat (counts .size (), is (4 ));
4949 assertThat (counts , allOf (
5050 hasEntry ('A' , 0 ),
@@ -57,24 +57,24 @@ public void testRepetitiveSequenceWithOnlyGuanine() {
5757 @ Ignore ("Remove to run test" )
5858 @ Test
5959 public void testCountsOnlyThymine () {
60- DNA dna = new DNA ("GGGGGTAACCCGG" );
61- assertThat (dna .count ('T' ), is (1 ));
60+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("GGGGGTAACCCGG" );
61+ assertThat (nucleotideCounter .count ('T' ), is (1 ));
6262 }
6363
6464 @ Ignore ("Remove to run test" )
6565 @ Test
6666 public void testCountsANucleotideOnlyOnce () {
67- DNA dna = new DNA ("CGATTGGG" );
68- dna .count ('T' );
69- assertThat (dna .count ('T' ), is (2 ));
67+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("CGATTGGG" );
68+ nucleotideCounter .count ('T' );
69+ assertThat (nucleotideCounter .count ('T' ), is (2 ));
7070 }
7171
7272 @ Ignore ("Remove to run test" )
7373 @ Test
7474 public void testDnaCountsDoNotChangeAfterCountingAdenine () {
75- DNA dna = new DNA ("GATTACA" );
76- dna .count ('A' );
77- Map <Character , Integer > counts = dna .nucleotideCounts ();
75+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("GATTACA" );
76+ nucleotideCounter .count ('A' );
77+ Map <Character , Integer > counts = nucleotideCounter .nucleotideCounts ();
7878 assertThat (counts .size (), is (4 ));
7979 assertThat (counts , allOf (
8080 hasEntry ('A' , 3 ),
@@ -88,16 +88,16 @@ public void testDnaCountsDoNotChangeAfterCountingAdenine() {
8888 @ Test
8989 public void testValidatesNucleotides () {
9090 expectedException .expect (IllegalArgumentException .class );
91- DNA dna = new DNA ("GACT" );
92- dna .count ('X' );
91+ NucleotideCounter nucleotideCounter = new NucleotideCounter ("GACT" );
92+ nucleotideCounter .count ('X' );
9393 }
9494
9595 @ Ignore ("Remove to run test" )
9696 @ Test
9797 public void testCountsAllNucleotides () {
9898 String s = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" ;
99- DNA dna = new DNA (s );
100- Map <Character , Integer > counts = dna .nucleotideCounts ();
99+ NucleotideCounter nucleotideCounter = new NucleotideCounter (s );
100+ Map <Character , Integer > counts = nucleotideCounter .nucleotideCounts ();
101101 assertThat (counts .size (), is (4 ));
102102 assertThat (counts , allOf (
103103 hasEntry ('A' , 20 ),
0 commit comments