Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

created test #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public class GetLastElementTest {
@Test
public void test1() {
// given
String expected = "Dog";
String expected = "Get";
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", expected};
test(expected, input);
}

@Test
public void test2() {
// given
String expected = "Lazy";
String expected = "This";
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", expected};
test(expected, input);
}
Expand All @@ -28,7 +28,7 @@ public void test2() {
@Test
public void test3() {
// given
String expected = "The";
String expected = "Off";
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", expected};
test(expected, input);
}
Expand All @@ -37,7 +37,7 @@ public void test3() {
@Test
public void test4() {
// given
String expected = "Over";
String expected = "My";
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", expected};
test(expected, input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class GetMiddleElementTest {
@Test
public void test1() {
// given
String expected = "Quick";
String expected = "Get";
String[] input = {"The", expected, "Brown"};
test(expected, input);

Expand All @@ -17,7 +17,7 @@ public void test1() {
@Test
public void test2() {
// given
String expected = "Brown";
String expected = "This";
String[] input = {"The", "Quick", expected, "Fox", "Jumps"};
test(expected, input);

Expand All @@ -26,15 +26,15 @@ public void test2() {
@Test
public void test3() {
// given
String expected = "Fox";
String expected = "Off";
String[] input = {"The", "Quick", "Brown", expected, "Jumps", "Over", "The"};
test(expected, input);
}

@Test
public void test4() {
// given
String expected = "Jumps";
String expected = "My";
String[] input = {"The", "Quick", "Brown", "Fox", expected, "Over", "The", "Lazy", "Dog"};
test(expected, input);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ public class RemoveLastElementTest {
@Test
public void test1() {
// given
String[] expected = {"The", "Quick"};
String[] input = {"The", "Quick", "Brown"};
String[] expected = {"Get", "Quick"};
String[] input = {"Get", "Quick", "Brown"};
test(expected, input);

}

@Test
public void test2() {
// given
String[] expected = {"The", "Quick", "Brown", "Fox"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps"};
String[] expected = {"This", "Quick", "Brown", "Fox"};
String[] input = {"This", "Quick", "Brown", "Fox", "Jumps"};
test(expected, input);
}

@Test
public void test3() {
// given
String[] expected = {"The", "Quick", "Brown", "Fox", "Jumps", "Over"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The"};
String[] expected = {"Off", "Quick", "Brown", "Fox", "Jumps", "Over"};
String[] input = {"Off", "Quick", "Brown", "Fox", "Jumps", "Over", "The"};
test(expected, input);
}


@Test
public void test4() {
// given
String[] expected = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"};
String[] expected = {"My", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy"};
String[] input = {"My", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"};
test(expected, input);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ public class RemoveMiddleElementTest {
@Test
public void test1() {
// given
String[] expected = {"The", "Brown"};
String[] input = {"The", "Quick", "Brown"};
String[] expected = {"Get", "This"};
String[] input = {"Get", "Quick", "This"};
test(expected, input);

}

@Test
public void test2() {
// given
String[] expected = {"The", "Quick", "Fox", "Jumps"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps"};
String[] expected = {"Get", "This", "Off", "My"};
String[] input = {"Get", "This", "Brown", "Off", "My"};
test(expected, input);
}

@Test
public void test3() {
// given
String[] expected = {"The", "Quick", "Brown", "Jumps", "Over", "The"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The"};
String[] expected = {"Get", "This", "Off", "Fox", "My", "Plate"};
String[] input = {"Get", "This", "Off", "Fox", "Of", "My", "Plate"};
test(expected, input);
}


@Test
public void test4() {
// given
String[] expected = {"The", "Quick", "Brown", "Fox", "Over", "The", "Lazy", "Dog"};
String[] input = {"The", "Quick", "Brown", "Fox", "Jumps", "Over", "The", "Lazy", "Dog"};
String[] expected = {"Get", "This", "Off", "Of", "My", "Damn", "Errand", "List"};
String[] input = {"Get", "This", "Off", "Of", "Jumps", "My", "Damn", "Errand", "List"};
test(expected, input);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,25 @@ private void test(List<Spice> expected) {
@Test
public void test1() {
// given
test(Arrays.asList((Spice) new Curry()));
test(Arrays.asList(
(Spice) new Curry(),
(Spice) new Curry()));
}

@Test
public void test2() {
// given
test(Arrays.asList((Spice) new Ginger()));
test(Arrays.asList(
(Spice) new Ginger(),
(Spice) new Ginger()));
}

@Test
public void test3() {
// given
test(Arrays.asList((Spice) new Pepper()));
test(Arrays.asList(
(Spice) new Pepper(),
(Spice) new Pepper()));
}

@Test
Expand All @@ -52,6 +58,7 @@ public void test4() {
test(Arrays.asList(
(Spice) new Pepper(),
(Spice) new Ginger(),
(Spice) new Ginger(),
(Spice) new Curry()));
}

Expand All @@ -62,6 +69,7 @@ public void test5() {
(Spice) new Pepper(),
(Spice) new Pepper(),
(Spice) new Ginger(),
(Spice) new Curry(),
(Spice) new Curry()));
}

Expand All @@ -72,6 +80,8 @@ public void test6() {
test(Arrays.asList(
(Spice) new Pepper(),
(Spice) new Pepper(),
(Spice) new Pepper(),
(Spice) new Ginger(),
(Spice) new Ginger(),
(Spice) new Ginger(),
(Spice) new Curry()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,32 @@ private void test(Integer amountOfIngredients, Supplier<?> ingredientSupplier) {

@Test
public void test1() {
test(5, Pepper::new);
test(50, Pepper::new);
}

@Test
public void test2() {
test(10, Pepper::new);
test(100, Pepper::new);
}

@Test
public void test3() {
test(3, Curry::new);
test(30, Curry::new);
}


@Test
public void test4() {
test(6, Curry::new);
test(60, Curry::new);
}

@Test
public void test5() {
test(2, Ginger::new);
test(20, Ginger::new);
}

@Test
public void test6() {
test(4, Ginger::new);
test(40, Ginger::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public class GetWordCountMapTest {
@Test
public void test1() {
// given
WordCounter wordCounter = new WordCounter("Hey");
WordCounter wordCounter = new WordCounter("Get");
Integer expected = 1;

// when
Map<String, Integer> map = wordCounter.getWordCountMap();
Integer actual = map.get("Hey");
Integer actual = map.get("Get");

// then
Assert.assertEquals(expected, actual);
Expand All @@ -24,12 +24,12 @@ public void test1() {
@Test
public void test2() {
// given
WordCounter wordCounter = new WordCounter("Hey", "Hey");
WordCounter wordCounter = new WordCounter("Get", "This");
Integer expected = 2;

// when
Map<String, Integer> map = wordCounter.getWordCountMap();
Integer actual = map.get("Hey");
Integer actual = map.get("Get");

// then
Assert.assertEquals(expected, actual);
Expand All @@ -38,14 +38,14 @@ public void test2() {
@Test
public void test3() {
// given
WordCounter wordCounter = new WordCounter("Hey", "Hey", "Hello");
WordCounter wordCounter = new WordCounter("Get", "Get", "This");
Integer expectedHey = 2;
Integer expectedHello = 1;

// when
Map<String, Integer> map = wordCounter.getWordCountMap();
Integer actualHey = map.get("Hey");
Integer actualHello = map.get("Hello");
Integer actualHey = map.get("Get");
Integer actualHello = map.get("This");

// then
Assert.assertEquals(expectedHey, actualHey);
Expand All @@ -56,14 +56,14 @@ public void test3() {
@Test
public void test4() {
// given
WordCounter wordCounter = new WordCounter("Hey", "Hey", "Hello", "Hello", "Hello");
WordCounter wordCounter = new WordCounter("Get", "Get", "This", "This", "This");
Integer expectedHey = 2;
Integer expectedHello = 3;

// when
Map<String, Integer> map = wordCounter.getWordCountMap();
Integer actualHey = map.get("Hey");
Integer actualHello = map.get("Hello");
Integer actualHey = map.get("Get");
Integer actualHello = map.get("This");

// then
Assert.assertEquals(expectedHey, actualHey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ public class AddTest {
@Test
public void test1() {
// given
test(99.0, 10.5, 88.5);
test(100.0, 50.0, 50.0);
}

@Test
public void test2() {
// given
test(40.12, 19.93, 20.19);
test(150.0, 50.0, 150.0);
}

@Test
public void test3() {
// given
test(39.94, 19.94, 20.00);
test(50.0, 25.0, 25.0);
}

@Test
public void test4() {
// given
test(100.00, 50.0, 50.0);
test(75.0, 25.0, 50.0);
}

@Test
public void test5() {
// given
test(22.10, 7.06, 15.04);
test(25.0, 12.5, 12.5);
}

private void test(Double expected, Double input1, Double input2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ public class DivideTest {
@Test
public void test1() {
// given
test(12.0, 144.0, 12.0);
test(1.0, 100.0, 100.0);
}

@Test
public void test2() {
// given
test(5.0, 60.0, 12.0);
test(2.0, 100.0, 50.0);
}

@Test
public void test3() {
// given
test(6.0, 36.0, 6.0);
test(4.0, 100.0, 25.0);
}

@Test
public void test4() {
// given
test(12.6, 63.0, 5.0);
test(8.0, 100.0, 12.5);
}

@Test
public void test5() {
// given
test(8.0, 72.0, 9.0);
test(16.0, 100.0, 6.25);
}

private void test(Double expected, Double input1, Double input2) {
Expand Down
Loading