org.eclipse.xtext.junit4.parameterized.XpectCommaSeparatedValues Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2011 itemis AG (http://www.itemis.eu) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
package org.eclipse.xtext.junit4.parameterized;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Collection;
import org.eclipse.xtext.junit4.parameterized.ActualCollection.ActualItem;
import org.eclipse.xtext.junit4.parameterized.ActualCollection.ToString;
import org.eclipse.xtext.junit4.parameterized.ExpectationCollection.ExpectationItem;
import org.eclipse.xtext.junit4.parameterized.IParameterProvider.IExpectation;
import org.eclipse.xtext.junit4.parameterized.TestExpectationValidator.ITestExpectationValidator;
import org.eclipse.xtext.junit4.parameterized.TestExpectationValidator.TestResult;
import org.eclipse.xtext.junit4.parameterized.XpectCommaSeparatedValues.CSVResultValidator;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.util.Pair;
import org.junit.Assert;
import org.junit.ComparisonFailure;
import com.google.common.base.Function;
/**
* use org.xpect.runner.Xpect from www.xpect-tests.org instead. In Xpect, test methods don't have return values anymore.
* Instead, the test expectation is passed in as method parameter. To handle a method with a CommaSeparatedValues
* expectation you can use a method declaration such as
*
* @Xpect public void scope(@CommaSeparatedValuesExpectation ICommaSeparatedValuesExpectation expectation) { }
*
* This class will be removed in the next release after 2.4.2
*
* @author Moritz Eysholdt - Initial contribution and API
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@TestExpectationValidator(validator = CSVResultValidator.class)
public @interface XpectCommaSeparatedValues {
public class CSVResultValidator implements ITestExpectationValidator> {
protected XpectCommaSeparatedValues cfg;
public CSVResultValidator(XpectCommaSeparatedValues cfg) {
this.cfg = cfg;
}
protected String str(int length) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < length; i++)
b.append(" ");
return b.toString();
}
public void validate(XtextResource res, IExpectation expectation, @TestResult Iterable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy