updated
This commit is contained in:
parent
b092be40c3
commit
009a23ebc0
|
|
@ -9,6 +9,9 @@ import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
import org.r0r5chach.valorant.ValorantAgent;
|
||||||
|
import org.r0r5chach.valorant.ValorantPlayer;
|
||||||
|
|
||||||
public class CompetitorList {
|
public class CompetitorList {
|
||||||
private final ArrayList<ValorantPlayer> competitors;
|
private final ArrayList<ValorantPlayer> competitors;
|
||||||
|
|
||||||
|
|
@ -43,7 +46,7 @@ public class CompetitorList {
|
||||||
private ValorantPlayer parseRow(String[] row) {
|
private ValorantPlayer parseRow(String[] row) {
|
||||||
int playerNumber = Integer.parseInt(row[0]);
|
int playerNumber = Integer.parseInt(row[0]);
|
||||||
Name playerName = new Name(row[1]);
|
Name playerName = new Name(row[1]);
|
||||||
ValorantRank playerLevel = ValorantRank.valueOf(row[2]);
|
Rank playerLevel = Rank.valueOf(row[2]);
|
||||||
ValorantAgent favoriteAgent = ValorantAgent.valueOf(row[3]);
|
ValorantAgent favoriteAgent = ValorantAgent.valueOf(row[3]);
|
||||||
int[] scores = parseScores(row[4]);
|
int[] scores = parseScores(row[4]);
|
||||||
return new ValorantPlayer(playerNumber, playerName, playerLevel, favoriteAgent, scores);
|
return new ValorantPlayer(playerNumber, playerName, playerLevel, favoriteAgent, scores);
|
||||||
|
|
@ -184,7 +187,7 @@ public class CompetitorList {
|
||||||
|
|
||||||
int[] freqs = generateLevelFreqs();
|
int[] freqs = generateLevelFreqs();
|
||||||
for (int i = 0; i < freqs.length; i++) {
|
for (int i = 0; i < freqs.length; i++) {
|
||||||
replaceVar( "%LEVEL"+i+"%", ValorantRank.values()[i].getRank());
|
replaceVar( "%LEVEL"+i+"%", Rank.values()[i].getRank());
|
||||||
replaceVar( "%VALUE"+i+"%", String.valueOf(freqs[i]));
|
replaceVar( "%VALUE"+i+"%", String.valueOf(freqs[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.ValorantRank;
|
import org.r0r5chach.Rank;
|
||||||
|
|
||||||
|
|
||||||
public class ValorantRankTest {
|
public class RankTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantRankTestGetRank() {
|
public void valorantRankTestGetRank() {
|
||||||
ValorantRank vR = ValorantRank.IRON;
|
Rank vR = Rank.BRONZE;
|
||||||
assertEquals("Iron", vR.getRank());
|
assertEquals("Bronze", vR.getRank());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.ValorantAgent;
|
import org.r0r5chach.valorant.ValorantAgent;
|
||||||
|
|
||||||
public class ValorantAgentTest {
|
public class ValorantAgentTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Name;
|
import org.r0r5chach.Name;
|
||||||
import org.r0r5chach.ValorantAgent;
|
import org.r0r5chach.Rank;
|
||||||
import org.r0r5chach.ValorantPlayer;
|
import org.r0r5chach.valorant.ValorantAgent;
|
||||||
import org.r0r5chach.ValorantRank;
|
import org.r0r5chach.valorant.ValorantPlayer;
|
||||||
public class ValorantPlayerTest {
|
public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTest() {
|
public void valorantPlayerTest() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
assertEquals(2, vP.getPlayerNumber());
|
assertEquals(2, vP.getPlayerNumber());
|
||||||
assertEquals("Joshua Luke Perry", vP.getPlayerName().getFullName());
|
assertEquals("Joshua Luke Perry", vP.getPlayerName().getFullName());
|
||||||
assertEquals("Gold", vP.getPlayerLevel().getRank());
|
assertEquals("Gold", vP.getPlayerLevel().getRank());
|
||||||
assertEquals("Fade", vP.getFavouriteAgent().getAgent());
|
assertEquals("Fade", vP.getFavoriteAgent().getAgent());
|
||||||
assertEquals(5, vP.getOverallScore());
|
assertEquals(5, vP.getOverallScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerNumber() {
|
public void valorantPlayerTestSetPlayerNumber() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
vP.setPlayerNumber(5);
|
vP.setPlayerNumber(5);
|
||||||
assertEquals(5, vP.getPlayerNumber());
|
assertEquals(5, vP.getPlayerNumber());
|
||||||
|
|
@ -28,7 +28,7 @@ public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerName() {
|
public void valorantPlayerTestSetPlayerName() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
vP.setPlayerName(new Name("Bradley Gordon-Taylor"));
|
vP.setPlayerName(new Name("Bradley Gordon-Taylor"));
|
||||||
assertEquals("Bradley Gordon-Taylor", vP.getPlayerName().getFullName());
|
assertEquals("Bradley Gordon-Taylor", vP.getPlayerName().getFullName());
|
||||||
|
|
@ -37,25 +37,25 @@ public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetPlayerLevel() {
|
public void valorantPlayerTestSetPlayerLevel() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
vP.setPlayerLevel(ValorantRank.BRONZE);
|
vP.setPlayerLevel(Rank.BRONZE);
|
||||||
assertEquals("Bronze", vP.getPlayerLevel().getRank());
|
assertEquals("Bronze", vP.getPlayerLevel().getRank());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetFavouriteAgent() {
|
public void valorantPlayerTestSetFavoriteAgent() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
vP.setFavouriteAgent(ValorantAgent.VIPER);
|
vP.setFavoriteAgent(ValorantAgent.VIPER);
|
||||||
assertEquals("Viper", vP.getFavouriteAgent().getAgent());
|
assertEquals("Viper", vP.getFavoriteAgent().getAgent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestSetScores() {
|
public void valorantPlayerTestSetScores() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
vP.setScores(new int[]{0, 0, 0, 0, 0, 0});
|
vP.setScores(new int[]{0, 0, 0, 0, 0, 0});
|
||||||
assertEquals(0, vP.getOverallScore());
|
assertEquals(0, vP.getOverallScore());
|
||||||
|
|
@ -64,20 +64,20 @@ public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetOverallScore() {
|
public void valorantPlayerTestGetOverallScore() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
assertEquals(5, vP.getOverallScore());
|
assertEquals(5, vP.getOverallScore());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetFullDetails() {
|
public void valorantPlayerTestGetFullDetails() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
assertEquals("""
|
assertEquals("""
|
||||||
Player Number: 2
|
Player Number: 2
|
||||||
Name: Joshua Luke Perry
|
Name: Joshua Luke Perry
|
||||||
Player Level: Gold
|
Player Level: Gold
|
||||||
Favourite Agent: Fade
|
Favorite Agent: Fade
|
||||||
Scores: 5, 5, 5, 5, 5, 5
|
Scores: 5, 5, 5, 5, 5, 5
|
||||||
Overall Score: 5.0""", vP.getFullDetails());
|
Overall Score: 5.0""", vP.getFullDetails());
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +85,7 @@ public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetShortDetails() {
|
public void valorantPlayerTestGetShortDetails() {
|
||||||
int[] scores = {5,5,5,5,5,5};
|
int[] scores = {5,5,5,5,5,5};
|
||||||
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), ValorantRank.GOLD, ValorantAgent.FADE, scores);
|
ValorantPlayer vP = new ValorantPlayer(2,new Name("Joshua Luke Perry"), Rank.GOLD, ValorantAgent.FADE, scores);
|
||||||
|
|
||||||
assertEquals("CN 2 (JLP) has overall score 5.0", vP.getShortDetails());
|
assertEquals("CN 2 (JLP) has overall score 5.0", vP.getShortDetails());
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +107,7 @@ public class ValorantPlayerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTestGetFavouriteAgent() {
|
public void valorantPlayerTestGetFavoriteAgent() {
|
||||||
//Already tested in valorantPlayerTest()
|
//Already tested in valorantPlayerTest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue