
org.specrunner.result.IResultSet Maven / Gradle / Ivy
/*
SpecRunner - Acceptance Test Driven Development Tool
Copyright (C) 2011-2013 Thiago Santos
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see
*/
package org.specrunner.result;
import java.util.List;
import org.specrunner.context.IBlock;
import org.specrunner.context.IContext;
import org.specrunner.plugins.ActionType;
import org.specrunner.util.xom.IPresentation;
/**
* A result set.
*
* @author Thiago Santos
*
*/
public interface IResultSet extends List, IStatus, IPresentation {
/**
* Feature for disable success recording.
*/
String FEATURE_RECORD_SUCCESS = IResultSet.class.getName() + ".recordSuccess";
/**
* Feature for expected messages.
*/
String FEATURE_EXPECTED_MESSAGES = IResultSet.class.getName() + ".messages";
/**
* Feature for messages expectation order.
*/
String FEATURE_EXPECTED_SORTED = IResultSet.class.getName() + ".sorted";
/**
* Setting to record success action in result set.
*
* @param recordSuccess
* The record success.
*/
void setRecordSuccess(Boolean recordSuccess);
/**
* Flag to record status which isError
returns true. Default is
* true
.
*
* @return true, if record success flag is enabled, false, to record only
* error status.
*/
Boolean getRecordSuccess();
/**
* Set expected messages.
*
* @param expected
* Expected messages.
*/
void setMessages(String[] expected);
/**
* Get the expected messages.
*
* @return The messages.
*/
String[] getMessages();
/**
* Set expected order of messages.
*
* @param sorted
* true, if expected messages must obey the specification order,
* false, otherwise. Default might be false.
*/
void setSorted(Boolean sorted);
/**
* Get the sort flag.
*
* @return true, of order required, false, otherwise.
*/
Boolean getSorted();
/**
* Consolidate expectations and received errors.
*
* @param context
* The context.
*/
void consolidate(IContext context);
/**
* Lists status in result.
*
* @param
* A subclass of Status
.
* @return An iterator of status.
*/
Iterable availableStatus();
/**
* Lists error status in result.
*
* @param
* A subclass of Status
.
* @return An iterator of status of type error in result.
*/
List errorStatus();
/**
* Filters result by status type.
*
* @param
* A subclass of Status
.
* @param status
* The filters.
* @return The subset of status.
*/
List filterByStatus(T... status);
/**
* Filters result by status type.
*
* @param
* A subtype of Status.
* @param start
* Range start.
* @param end
* Range end.
* @param status
* The filters.
* @return The subset of status.
*/
List filterByStatus(int start, int end, T... status);
/**
* Counts the status of a given type.
*
* @param
* A subtype of Status
.
* @param status
* The filters.
* @return The number of result.
*/
int countStatus(T... status);
/**
* Counts the status of a given type.
*
* @param start
* Range start.
* @param end
* Range end.
* @param
* A status class.
* @param status
* The filters.
* @return The number of result.
*/
int countStatus(int start, int end, T... status);
/**
* List action types available for all results.
*
* @return The list of types.
*/
List actionTypes();
/**
* List action types available for the result subset.
*
* @param subset
* Subset to be analyzed.
* @return The list of types.
*/
List actionTypes(List subset);
/**
* Filter the result itself by ActionType
.
*
* @param actionType
* The action types.
* @return The filtered subset.
*/
List filterByType(ActionType... actionType);
/**
* Filter the subset by ActionType
.
*
* @param subset
* The subset to be filtered.
* @param actionType
* The action types.
* @return The filtered subset.
*/
List filterByType(List subset, ActionType... actionType);
/**
* Count results of a given set of action types.
*
* @param actionType
* The action types.
* @return The size of the filtered set.
*/
int countType(ActionType... actionType);
/**
* Count results of a given type in a list.
*
* @param subset
* A subset of results.
* @param actionType
* The action types.
* @return The size of the filtered set.
*/
int countType(List subset, ActionType... actionType);
/**
* Add a result.
*
* @param status
* The status.
* @param source
* The source block.
* @return The result.
*/
IResult addResult(Status status, IBlock source);
/**
* Adds a result.
*
* @param status
* The status.
* @param source
* The source block.
* @param writable
* A writable information.
* @return The result.
*/
IResult addResult(Status status, IBlock source, IWritable writable);
/**
* Adds a result with a message.
*
* @param status
* The status.
* @param source
* The source block.
* @param message
* The message.
* @return The result.
*/
IResult addResult(Status status, IBlock source, String message);
/**
* Adds a result with a message and a writable information.
*
* @param status
* The status.
* @param source
* The source block.
* @param message
* The message.
* @param writable
* The extra information.
* @return The result.
*/
IResult addResult(Status status, IBlock source, String message, IWritable writable);
/**
* Adds a result with failure information.
*
* @param status
* The status.
* @param source
* The source block.
* @param failure
* The failure.
* @return The result.
*/
IResult addResult(Status status, IBlock source, Throwable failure);
/**
* Adds a result with failure and a writable information.
*
* @param status
* The status.
* @param source
* The source block.
* @param failure
* The failure.
* @param writable
* The extra information.
* @return The result.
*/
IResult addResult(Status status, IBlock source, Throwable failure, IWritable writable);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy