Skip to content

Commit

Permalink
Addressed pull request comments:
Browse files Browse the repository at this point in the history
- Classes as a whole removed, not just method/constructor stubs
- Commenting out tests undone per discussion, exercism#683
- Enum 'Plant' re-added to Kindergarten Garden per discussion
- .keep added to empty source folders
  • Loading branch information
redshirt4 committed Jul 6, 2017
1 parent 4a8540d commit 0deaff1
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 126 deletions.
Empty file.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,43 +23,43 @@ public void setUp() {

@Test
public void testZeroStepsRequiredWhenStartingFrom1() {
// assertEquals(0, collatzCalculator.computeStepCount(1));
assertEquals(0, collatzCalculator.computeStepCount(1));
}

@Ignore("Remove to run test")
@Test
public void testCorrectNumberOfStepsWhenAllStepsAreDivisions() {
// assertEquals(4, collatzCalculator.computeStepCount(16));
assertEquals(4, collatzCalculator.computeStepCount(16));
}

@Ignore("Remove to run test")
@Test
public void testCorrectNumberOfStepsWhenBothStepTypesAreNeeded() {
// assertEquals(9, collatzCalculator.computeStepCount(12));
assertEquals(9, collatzCalculator.computeStepCount(12));
}

@Ignore("Remove to run test")
@Test
public void testAVeryLargeInput() {
// assertEquals(152, collatzCalculator.computeStepCount(1000000));
assertEquals(152, collatzCalculator.computeStepCount(1000000));
}

@Ignore("Remove to run test")
@Test
public void testZeroIsConsideredInvalidInput() {
// expectedException.expect(IllegalArgumentException.class);
// expectedException.expectMessage("Only natural numbers are allowed");
//
// collatzCalculator.computeStepCount(0);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Only natural numbers are allowed");

collatzCalculator.computeStepCount(0);
}

@Ignore("Remove to run test")
@Test
public void testNegativeIntegerIsConsideredInvalidInput() {
// expectedException.expect(IllegalArgumentException.class);
// expectedException.expectMessage("Only natural numbers are allowed");
//
// collatzCalculator.computeStepCount(-15);
expectedException.expect(IllegalArgumentException.class);
expectedException.expectMessage("Only natural numbers are allowed");

collatzCalculator.computeStepCount(-15);
}

}

This file was deleted.

21 changes: 21 additions & 0 deletions exercises/kindergarten-garden/src/main/java/Plant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public enum Plant {
VIOLETS,
RADISHES,
CLOVER,
GRASS;

public static Plant getPlant(char plantCode) {
switch (plantCode) {
case 'G':
return GRASS;
case 'C':
return CLOVER;
case 'R':
return RADISHES;
case 'V':
return VIOLETS;
}

return null;
}
}
216 changes: 108 additions & 108 deletions exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,173 +10,173 @@ public class KindergartenGardenTest {

@Test
public void singleStudent() {
// String student = "Alice";
// String plants = "RC\nGG";
// List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.CLOVER, Plant.GRASS, Plant.GRASS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Alice";
String plants = "RC\nGG";
List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.CLOVER, Plant.GRASS, Plant.GRASS);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void singleStudent2() {
// String student = "Alice";
// String plants = "VC\nRC";
// List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.CLOVER);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Alice";
String plants = "VC\nRC";
List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.CLOVER);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void twoStudents() {
// String student = "Bob";
// String plants = "VVCG\nVVRC";
// List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.RADISHES, Plant.CLOVER);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Bob";
String plants = "VVCG\nVVRC";
List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.RADISHES, Plant.CLOVER);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void oneGardenSecondStudent() {
// String student = "Bob";
// String plants = "VVCCGG\nVVCCGG";
// List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.CLOVER, Plant.CLOVER, Plant.CLOVER);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Bob";
String plants = "VVCCGG\nVVCCGG";
List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.CLOVER, Plant.CLOVER, Plant.CLOVER);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void oneGardenThirdStudent() {
// String student = "Charlie";
// String plants = "VVCCGG\nVVCCGG";
// List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.GRASS, Plant.GRASS, Plant.GRASS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Charlie";
String plants = "VVCCGG\nVVCCGG";
List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.GRASS, Plant.GRASS, Plant.GRASS);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void fullGardenFirstStudent() {
// String student = "Alice";
// String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
// List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.RADISHES, Plant.VIOLETS, Plant.RADISHES);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Alice";
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.RADISHES, Plant.VIOLETS, Plant.RADISHES);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void fullGardenSecondStudent() {
// String student = "Bob";
// String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
// List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.CLOVER, Plant.CLOVER);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Bob";
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.CLOVER, Plant.CLOVER);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void fullGardenSecondToLastStudent() {
// String student = "Kincaid";
// String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
// List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.CLOVER, Plant.CLOVER, Plant.GRASS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Kincaid";
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.CLOVER, Plant.CLOVER, Plant.GRASS);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void fullGardenLastStudent() {
// String student = "Larry";
// String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
// List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.VIOLETS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants).getPlantsOfStudent(student)
// );
String student = "Larry";
String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.VIOLETS);

assertEquals(
expected,
new KindergartenGarden(plants).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void customStudentGardenFirstStudentInAlphabeticalOrder() {
// String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
// String student = "Patricia";
// String plants = "VCRRGVRG\nRVGCCGCV";
// List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
// );
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
String student = "Patricia";
String plants = "VCRRGVRG\nRVGCCGCV";
List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS);

assertEquals(
expected,
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void customStudentGardenSecondStudentInAlphabeticalOrder() {
// String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
// String student = "Roger";
// String plants = "VCRRGVRG\nRVGCCGCV";
// List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
// );
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
String student = "Roger";
String plants = "VCRRGVRG\nRVGCCGCV";
List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER);

assertEquals(
expected,
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void customStudentGardenThirdStudentInAlphabeticalOrder() {
// String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
// String student = "Samantha";
// String plants = "VCRRGVRG\nRVGCCGCV";
// List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
// );
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
String student = "Samantha";
String plants = "VCRRGVRG\nRVGCCGCV";
List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS);

assertEquals(
expected,
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
);
}

@Ignore("Remove to run test")
@Test
public void customStudentGardenFourthStudentInAlphabeticalOrder() {
// String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
// String student = "Xander";
// String plants = "VCRRGVRG\nRVGCCGCV";
// List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS);
//
// assertEquals(
// expected,
// new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
// );
String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
String student = "Xander";
String plants = "VCRRGVRG\nRVGCCGCV";
List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS);

assertEquals(
expected,
new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
);
}
}

0 comments on commit 0deaff1

Please sign in to comment.