@Test public void testMaisDeUmaPartida() throws IOException, ParseException { String filePath = getFilePath("TestTotalMortes"); gerarArquivoMaisDeUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); assertEquals(2, mainClass.getMatches(arq).size()); }
@Test public void testTotalMortes() throws IOException, ParseException { String filePath = getFilePath("TestTotalMortes"); gerarArquivoUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); Player playerNick = new Player("Nick"); playerNick.setKillCounter(2); Match match = mainClass.getMatches(arq).get(0); assertEquals(playerNick.getDeathCounter(), match.getPlayers().get(0).getDeathCounter()); }
@Test public void testIdPartida() throws IOException, ParseException { String filePath = getFilePath("TestIdPartida"); gerarArquivoUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); Match partida = new Match(); partida.setIdMatch(11348965); Match match = mainClass.getMatches(arq).get(0); assertEquals(partida.getIdMatch(), match.getIdMatch()); deleteFile(filePath); }
@Test public void testTotalAssassinatosMaisDeUmaPartida() throws IOException, ParseException { String filePath = getFilePath("TestTotalMortes"); gerarArquivoMaisDeUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); Player playerJoao = new Player("Joao"); playerJoao.setKillCounter(2); assertEquals( playerJoao.getKillCounter(), mainClass.getMatches(arq).get(1).getPlayers().get(2).getKillCounter()); }
@Test public void testTotalAssassinatos() throws IOException, ParseException { String filePath = getFilePath("TestTotalAssassinatos"); gerarArquivoUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); Player playerRoman = new Player("Roman"); playerRoman.setKillCounter(1); List<Player> playerList = new ArrayList<Player>(); playerList.add(playerRoman); Match match = mainClass.getMatches(arq).get(0); assertEquals(playerRoman.getKillCounter(), match.getPlayers().get(0).getKillCounter()); }
@Test public void testReadLog() { String filePath = getFilePath("TestReadLog"); gerarArquivoUmaPartida(filePath); assertNotNull(mainClass.ReadLog(filePath)); deleteFile(filePath); }
@Test public void testDataInicioPartida() throws IOException, ParseException { String filePath = getFilePath("TestDataInicioPartida"); gerarArquivoUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); Date date = (java.util.Date) formatter.parse("23/04/2013 15:34:22"); Match partida = new Match(); partida.setTimeStart(date); Match match = mainClass.getMatches(arq).get(0); assertEquals(partida.getTimeStart(), match.getTimeStart()); deleteFile(filePath); }
@Test public void testGetPlayers() throws IOException, ParseException { String filePath = getFilePath("TestGetPlayers"); gerarArquivoUmaPartida(filePath); BufferedReader arq = mainClass.ReadLog(filePath); Player player1 = new Player("Roman"); Player player2 = new Player("Nick"); List<Player> playerList = new ArrayList<Player>(); playerList.add(player1); playerList.add(player2); Match match = mainClass.getMatches(arq).get(0); assertEquals(playerList, match.getPlayers()); deleteFile(filePath); }