-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathElectionLandTest.java
More file actions
51 lines (44 loc) · 1.91 KB
/
ElectionLandTest.java
File metadata and controls
51 lines (44 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.dtcc.exams.assessment.part5;
import com.dtcc.exams.part5.ElectionLand;
import org.junit.Assert;
import org.junit.Test;
public class ElectionLandTest {
@Test
public void electionWinnerTest1(){
String[] votes = {"Alex","Michael","Harry","Dave","Michael","Victor","Harry","Alex","Mary","Mary"};
ElectionLand electionLand = new ElectionLand();
String expected = "Michael";
String actual = electionLand.electionWinner(votes);
Assert.assertEquals(expected, actual);
}
@Test
public void electionWinnerTest2(){
String[] votes = {"Victor", "Veronica","Ryan", "Dave", "Maria", "Maria", "Farah", "Farah", "Ryan", "Veronica"};
ElectionLand electionLand = new ElectionLand();
String expected = "Veronica";
String actual = electionLand.electionWinner(votes);
Assert.assertEquals(expected, actual);
}
@Test
public void electionWinnerTest3(){
String[] votes = {"Alice", "Allison", "Alice", "Allison", "Ashley","Ashley"};
ElectionLand electionLand = new ElectionLand();
String expected = "Ashley";
String actual = electionLand.electionWinner(votes);
Assert.assertEquals(expected, actual);
}
@Test
public void electionWinnerTest4(){
String[] votes = {"hfail" ,"bz","hfail","ru" ,"fkqb","fkqb"
,"hfail","ru","ru","hfail","bz","fkqb","bz","bz"
,"fkqb","bz","fkqb","ru","fkqb","ru","ru","bz"
,"hfail","fkqb","hfail","bz","hfail","ru","hfail" ,"bz"
,"bz" ,"bz" ,"fkqb","ru","fkqb","hfail","fkqb","bz"
,"bz","hfail","hfail","hfail","bz","hfail","ru"
,"ru","hfail","hfail","bz","hfail"};
ElectionLand electionLand = new ElectionLand();
String expected = "hfail";
String actual = electionLand.electionWinner(votes);
Assert.assertEquals(expected, actual);
}
}