@Override public void visitSpreadMapExpression(SpreadMapExpression expr) { result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), "*:" ); }
private Description getCurrentDescription() { if (currentIteration != null && currentFeature.isReportIterations()) return currentIteration.getDescription(); if (currentFeature != null) return currentFeature.getDescription(); return spec.getDescription(); } }
@Override public void visitClosureExpression(ClosureExpression expr) { result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), "{->}" ).setRelevant(false); }
private boolean handleProfileValues(SpecInfo spec) { if (!ProfileValueUtils.isTestEnabledInThisEnvironment(spec.getReflection())) { spec.setExcluded(true); return false; } for (FeatureInfo feature : spec.getAllFeatures()) if (!ProfileValueUtils.isTestEnabledInThisEnvironment( feature.getFeatureMethod().getReflection(), spec.getReflection())) feature.setExcluded(true); return true; } }
private IterationInfo createIterationInfo(Object[] dataValues, int estimatedNumIterations) { IterationInfo result = new IterationInfo(currentFeature, dataValues, estimatedNumIterations); String iterationName = currentFeature.getIterationNameProvider().getName(result); result.setName(iterationName); Description description = Description.createTestDescription(spec.getReflection(), iterationName, currentFeature.getFeatureMethod().getAnnotations()); result.setDescription(description); return result; }
private FrameworkMethod createFrameworkMethod(final IMethodInvocation invocation) { return new FrameworkMethod(invocation.getIteration().getParent().getFeatureMethod().getReflection()) { @Override public String getName() { return invocation.getIteration().getDescription().getMethodName(); } }; } }
private void describeFeature(FeatureInfo feature) { Description desc = describeMethod(feature.getFeatureMethod()); feature.setDescription(desc); if (feature.getDataProcessorMethod() != null) feature.getDataProcessorMethod().setDescription(desc); for (DataProviderInfo prov : feature.getDataProviders()) prov.getDataProviderMethod().setDescription(desc); }
private DataProviderInfo createDataProvider(FeatureInfo feature, MethodInfo method) { DataProviderMetadata metadata = method.getAnnotation(DataProviderMetadata.class); DataProviderInfo provider = new DataProviderInfo(); provider.setParent(feature); provider.setLine(metadata.line()); provider.setDataVariables(Arrays.asList(metadata.dataVariables())); provider.setDataProviderMethod(method); return provider; }
private void runFeatureMethod() { if (runStatus != OK) return; MethodInfo featureIteration = new MethodInfo(currentFeature.getFeatureMethod()); featureIteration.setIteration(currentIteration); invoke(currentInstance, featureIteration, currentIteration.getDataValues()); }
@Override public String toFeatureName(String methodName) { for (FeatureInfo feature : getAllFeatures()) if (feature.hasBytecodeName(methodName)) return feature.getName(); return methodName; } }
private boolean allFeaturesExcluded(SpecInfo spec) { for (FeatureInfo feature : spec.getAllFeatures()) if (!feature.isExcluded()) return false; return true; }
private void excludeAllFeatures(SpecInfo spec) { for (FeatureInfo feature : spec.getAllFeatures()) feature.setExcluded(true); }
@Override public void visitSpecAnnotation(RestoreSystemProperties annotation, SpecInfo spec) { for (FeatureInfo feature : spec.getFeatures()) { feature.addInterceptor(RestoreSystemPropertiesInterceptor.INSTANCE); } }
private void sortFeaturesInDeclarationOrder(SpecInfo spec) { for (FeatureInfo feature : spec.getFeatures()) feature.setExecutionOrder(feature.getDeclarationOrder()); }
public void shiftVertically(int numLines) { region = region.shiftVertically(numLines); anchor = anchor.shiftVertically(numLines); }
@Override public void visitVariableExpression(VariableExpression expr) { result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), expr.getName() ).setRelevant(expr != VariableExpression.THIS_EXPRESSION && expr != VariableExpression.SUPER_EXPRESSION); }
@Override public void visitClassExpression(ClassExpression expr) { // also used in phase conversion, e.g. in instanceof expression result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), null ); }
@Override public void visitConstantExpression(ConstantExpression expr) { result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), expr.getConstantName() ).setRelevant(false); }
@Override public void visitFieldExpression(FieldExpression expr) { result = new ExpressionInfo( TextRegion.of(expr), TextPosition.startOf(expr), expr.getFieldName() ); }