* appears 2 times, in type Scenario and Service
*/
@Test
public void validateSearchResultScenarioContent() {
IMockeyStorage store = new InMemoryMockeyStorage();
Service a = new Service();
a.setServiceName("Service A");
Scenario aScenario = new Scenario();
aScenario.setScenarioName("Scenario A");
aScenario.setResponseMessage("lorem ipsum");
a.saveOrUpdateScenario(aScenario);
store.saveOrUpdateService(a);
String term = "cats";
SearchResultBuilder resultBuilder = new SearchResultBuilder();
List<SearchResult> resultList = resultBuilder.buildSearchResults(term,
store);
assert (resultList.size() == 0) : "Length should be 0 but was "
+ resultList.size();
term = " lorem ";
resultBuilder = new SearchResultBuilder();
resultList = resultBuilder.buildSearchResults(term, store);
assert (resultList.size() == 1) : "Length should be: 1 " + " but was '"
+ resultList.size() + "'";
assert (resultList.get(0).getType() == SearchResultType.SERVICE_SCENARIO) : "Search type result should be 'scenario' but was '"
+ resultList.get(0).getType().toString() + "'";
aScenario = new Scenario();
aScenario.setScenarioName("Scenario B");
aScenario.setResponseMessage("lorem ipsula");
a.saveOrUpdateScenario(aScenario);
store.saveOrUpdateService(a);
term = " lorem ";
resultBuilder = new SearchResultBuilder();
resultList = resultBuilder.buildSearchResults(term, store);
// We should have TWO scenarios with 'lorem' in content/