mercredi 9 septembre 2015

Best way to test hardcoded data

I have a class, which parses data from html page and turns it into a collection of String. Basically I have a URL of online-shop and I want to have a list of its items. My class have the following signature:

public static List<String> getShopItems()

usually method returns very large List (4k items or more). My question is, how can I test this method? I think that I have to assert that returned list has correct size and contains all the items needed. But it would be very tedious to create List with 4k items and compare actual and expected Lists. Furthermore, items can change in the future, and my test will fail.

To sum it up, I can get actual data from my method getShopItems(), but I have no idea how to get expected data for assertion in test. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire