Failure in ArrayStoreException

54 views Asked by At

I have a question:

I have such a BDD table:

 And the following set of "Dishes"
    | Dish name      |calories| quality | cost |
    | grilled chicken|  400   |  high   |  12  |
    | lasagna        |  800   |  low    |   7  | 
    | gnocchi        |  700   |  high   |  12  |
    | pizza          |  400   |  low    |   7  |
    | snitzel        |  400   |  high   |   12 |
 And the following set of "Beverages"
    | Beverage name  | volume | quality | cost |
    | coke           |   35   |  high   |  5   |
    | fanta          |   35   |  low    |  2   | 
    | wine           |   50   |  high   |  5   |
    | beer           |   50   |  low    |  2   |
    | sprite         |   35   |  high   |  5   |

and this is the implementation method os BDD data table.

public void the_following_set_of(String type, DataTable list) throws Throwable 
{

    if (type.equals("Dishes"))
    {
        List<List<String>> dishes = list.raw();
        String[][] newdishes = new String[6][4];
        newdishes.equals(dishes.toArray(newdishes));

        for (int i = 1; i < 6; i++)
        {
            if (newdishes[i][2] == "high")
                kalite.equals(Quality.high);
            else
                kalite.equals(Quality.low);

            dishess.add(new Dish(newdishes[i][0], Integer.parseInt(newdishes[i][1]), kalite, Integer.parseInt(newdishes[i][3])));

        }
    }

    if (type.equals("Beverages"))
    {
        List<List<String>> beverages = list.raw();
        String[][] newbeverages = new String[6][4];
        newbeverages = beverages.toArray(newbeverages);


        for (int i = 1; i < 6; i++)
        {
            if (newbeverages[i][2] == "high")
                kalite.equals(Quality.high);
            else
                kalite.equals(Quality.low);

            beveragess.add(new Beverage(newbeverages[i][0], Integer.parseInt(newbeverages[i][1]), kalite, Integer.parseInt(newbeverages[i][3])));

        }
    }
    restaurant.createMenu(dishess, beveragess);
}

I couldn't survive from ArrayStoreException here. Normally i'm trying to do cucumber feature testing, but when i run it, i encounter this problem.

When I run it eclipse says the problem is on this line:

        newdishes.equals(dishes.toArray(newdishes));

How can i solve it?

Thanks.

0

There are 0 answers