R handleMethodInvocation(arglist&... args) override {
		unsigned int ordinal = Invocation::nextInvocationOrdinal();
		MethodInfo &method = this->getMethod();
		auto actualInvoaction = new ActualInvocation<arglist...>(ordinal, method, args...);

		// ensure deletion if not added to actual invocations.
		std::shared_ptr<Destructable> actualInvoactionDtor{actualInvoaction};

		auto invocationHandler = getInvocationHandlerForActualArgs(*actualInvoaction);
		if (invocationHandler) {
			auto &matcher = invocationHandler->getMatcher();
			actualInvoaction->setActualMatcher(&matcher);
			_actualInvocations.push_back(actualInvoactionDtor);
			try {
				return invocationHandler->handleMethodInvocation(args...);
			} catch (NoMoreRecordedActionException &) {
			}
		}

		UnexpectedMethodCallEvent event(UnexpectedType::Unmatched, *actualInvoaction);
		_fakeit.handle(event);
		std::string format{_fakeit.format(event)};
		UnexpectedMethodCallException e(format);
		throw e;

	}
Exemplo n.º 2
0
std::string VariantValue::getTypeAsString() const {
  switch (Type) {
  case VT_String: return "String";
  case VT_Matcher: return getMatcher().getTypeAsString();
  case VT_Unsigned: return "Unsigned";
  case VT_Nothing: return "Nothing";
  }
  llvm_unreachable("Invalid Type");
}
/** the returned matcher shall not be deleted by the user
 *
 * it is assumed that \code{vectorize_next()} is used:
 * for \code{i >= this->n} the last matcher is returned
 *
 *
 * @param i index
 * @param searchStr string to search in
 */
UStringSearch* StriContainerUStringSearch::getMatcher(R_len_t i, const UnicodeString& searchStr)
{
   return getMatcher(i, searchStr.getBuffer(), searchStr.length());
}