| Author |
How to mock a complicate content
|
Wladimir Babitzki
Greenhorn
Joined: Apr 27, 2004
Posts: 19
|
|
What I need, it should be a possibility to go through a html page, sort links from it and look if the pages, referenced with the links, have also links. All the found links should be represented as a tree structure, whereby each link element should point to its children elements, that also can have links. The implementation looks like: That�s not clear for me, what is the best way to test the searchLinksAsTree? It�s simple with searchLinksAsList, there I can feed a mock content and check expected results, but to mock the content for the multi dimensional searchLinksAsTree is hard work. I�ll appreciate any suggestion Thank you
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
How about mocking that searchListsAsList() method while testing for searchLinksAsTree()? I.e., instead of try something like
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
Wladimir Babitzki
Greenhorn
Joined: Apr 27, 2004
Posts: 19
|
|
|
Thanks! It�s really the simplest and nicest solution!
|
 |
 |
|
|
subject: How to mock a complicate content
|
|
|