private void validateTestSuiteMethod(IOpenMethod method, IOpenMethod existedMethod) { if (method instanceof IUriMember && existedMethod instanceof IUriMember) { if (!UriMemberHelper.isTheSame((IUriMember) method, (IUriMember) existedMethod)) { String message = ValidationMessages.getDuplicatedMethodMessage(existedMethod, method); addDuplicatedMethodError(message, method, existedMethod); } } else { throw new IllegalStateException("Implementation supports only IUriMember!"); } }
/** * In case we have several versions of one table we should add only the * newest or active version of table. * * @param newMethod The methods that we are trying to add. * @param key Method key of these methods based on signature. * @param existedMethod The existing method. */ protected IOpenMethod useActiveOrNewerVersion(IOpenMethod existedMethod, IOpenMethod newMethod, MethodKey key) throws DuplicatedMethodException { int compareResult = TableVersionComparator.getInstance().compare(existedMethod, newMethod); if (compareResult > 0) { return newMethod; } else if (compareResult == 0) { /** * Throw the error with the right message for the case when the * methods are equal */ if (newMethod instanceof IUriMember && existedMethod instanceof IUriMember) { if (!UriMemberHelper.isTheSame((IUriMember) newMethod, (IUriMember) existedMethod)) { String message = ValidationMessages.getDuplicatedMethodMessage(existedMethod, newMethod); throw new DuplicatedMethodException(message, existedMethod); } } else { throw new IllegalStateException("Implementation supports only IUriMember!"); } } return existedMethod; }
if (!UriMemberHelper.isTheSame((IUriMember) openField, (IUriMember) existedField)) { throw new DuplicatedFieldException("", openField.getName());