Аноним

Изменения

Groovy

1105 байт добавлено, 12:26, 22 апреля 2016
expect Matcher
* <code>startsWith(String)</code> - Creates a matcher that matches when the input buffer starts with the given string.
* <code>times(int, Matcher)</code> - Creates a matcher that matches if the given <code>Matcher</code> matches the <code>number</code> of times.
 
Примеры:
* <code>expect contains("vasya")</code> - то же самое, что и <code>expect "vasya"</code>
* <code>expect regexp("# $")</code> - ожидать, пока в output появится строка, соответствующая регулярному выражению "# $" (output будет заканчиваться на решетку и пробел)
* <code>expect times(3, contains("vasya_$num"))</code> - ожидать, пока в output 3 раза встретится строка "vasya_$num" ($num будет интерполировано)
* <code>expect anyOf(contains("vasya"), contains("petya"))</code> - ожидать, пока в output появится либо "vasya", либо "petya"
* <code>expect sequence(contains("vasya"), contains("petya"))</code> - ожидать, пока в output появится "vasya", а затем "petya" (именно в этом порядке)
* <code>expect allOf(contains("vasya"), contains("petya"))</code> - ожидать, пока в output появится "vasya" и "petya" (в любом порядке)