Exemplo n.º 1
0
  @Test
  public void testMaisDeUmaPartida() throws IOException, ParseException {
    String filePath = getFilePath("TestTotalMortes");
    gerarArquivoMaisDeUmaPartida(filePath);
    BufferedReader arq = mainClass.ReadLog(filePath);

    assertEquals(2, mainClass.getMatches(arq).size());
  }
Exemplo n.º 2
0
  @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());
  }
Exemplo n.º 3
0
  @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);
  }
Exemplo n.º 4
0
  @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());
  }
Exemplo n.º 5
0
  @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());
  }
Exemplo n.º 6
0
 @Test
 public void testReadLog() {
   String filePath = getFilePath("TestReadLog");
   gerarArquivoUmaPartida(filePath);
   assertNotNull(mainClass.ReadLog(filePath));
   deleteFile(filePath);
 }
Exemplo n.º 7
0
  @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);
  }
Exemplo n.º 8
0
  @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);
  }