java - Storing/logging/printing all the errors collected by errorcollector -
i have been using errorcollector rule collecting failed test cases code looks :
@rule errorcollector collector = new errorcollector(); map<x, y> inputoutputmap = new hashmap<x,y>(); inputoutputmap.add(new x("input"), new y("output")); //mocking service layers , returning expected outputs. for(entry<x,y> entry : inputoutputmap.entryset()){ string url = "/do/something" gson gson = new gson(); string json = gson.tojson(); try{ this.mockmvc.perform(get(url) .contenttype(mediatype.application_json) .content(json)).andexpect(status().isinternalservererror()); } catch(exception e) { collector.checkthat(e.getmessage, entry.getvalue().getmessage()); } } so problem after collecting errors there way can print errors way write test cases write way - iterating map , checking output respective input?
you extend errorcollector , create verify public. phone call , grab multiplefailureexception. throwables via getfailures.
getfailures
this improve re-implementing errorcollector scratch.
java junit errorcollector
No comments:
Post a Comment