sft.decorators.Table Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of SimpleFunctionalTest Show documentation
Show all versions of SimpleFunctionalTest Show documentation
A JUnit extension to easily adopt functional testing and acceptance testing
/*******************************************************************************
* Copyright (c) 2013, 2014 Sylvain Lézier.
* 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
*
* Contributors:
* Sylvain Lézier - initial implementation
*******************************************************************************/
package sft.decorators;
import sft.DefaultConfiguration;
import sft.result.FixtureCallResult;
import sft.result.UseCaseResult;
import java.util.List;
public class Table implements Decorator {
private DefaultConfiguration configuration;
private String name;
@Override
public Decorator withParameters(String... parameters) {
if(parameters.length > 0){
name=parameters[0];
}
return this;
}
@Override
public Decorator withConfiguration(DefaultConfiguration configuration) {
this.configuration = configuration;
return this;
}
@Override
public String applyOnUseCase(UseCaseResult useCaseResult, String result) {
throw new RuntimeException("Table couldn't be applied on use case");
}
@Override
public String applyOnScenario(String result) {
throw new RuntimeException("Table couldn't be applied on scenario");
}
@Override
public String applyOnFixtures(List instructions, List fixtureCallResuts) {
String result = "";
if(name != null ){
result+=""+name+" ";
}
result+="";
result+="";
for (String paramaterName : fixtureCallResuts.get(0).fixtureCall.fixture.parametersName) {
result+="" +paramaterName+" ";
}
result+=" ";
result+="";
result+="";
for (FixtureCallResult fixtureCallResutfixture : fixtureCallResuts) {
result+="" ;
for (String value : fixtureCallResutfixture.fixtureCall.parametersValues) {
result+="" +value+" ";
}
result+=" ";
}
result+="";
return result+"
";
}
@Override
public boolean comply(Decorator other) {
return other.getClass() == Table.class;
}
}