jeudi 1 octobre 2020

AssertionFailedError problem with ArrayList

I have this code:

     public void test1()
     {
        Capitaly c=new Capitaly();
        c.readFromFile("test1");
        c.game(5);
        String help="Balazs has 9000 capital and these property IDs: [] house (True/False): []";
        String help2=c.getPlayers().get(0).toString();
        System.out.println(help2);
        assertTrue(help.equals(help2));
    }

c.getPlayers() return an arrayList of Player objects, what could be the problem?

But this code is working:

ArrayList<Player> p = new ArrayList<Player>();
p.add(new TacticalPlayer(data[0],"T"));
String help="Balazs has 9000 capital and these property IDs: [] house (True/False): []";
String help2=p.get(0).toString();
assertTrue(help.equals(help2));

Aucun commentaire:

Enregistrer un commentaire