org.specrunner.features
Interface IFeatureManager

All Superinterfaces:
Map<String,Object>
All Known Implementing Classes:
FeatureManagerImpl

public interface IFeatureManager
extends Map<String,Object>

This is the standard way of parameterizing the framework objects. This is the standard way of parameterizing all tests in the same execution, to set specific features for each test separately use IConfiguration object.

Every class can read a feature by SpecRunnerService.get(IFeatureManager.class).getFeature("name"). See all IPlugin implementations to check all available features and how to use them.

Author:
Thiago Santos

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 IFeatureManager add(String feature, Object value)
          Set a feature to a value.
 IFeatureManager add(String feature, Object value, boolean override)
          Set a feature to a value.
 Object get(String key, Object defaultValue)
          Get a value from map, if not found, result is 'defaultValue'.
 void set(String feature, Object target)
          Sets a feature to an object if the feature exists and the type is compatible.
 void setConfiguration(IConfiguration cfg)
          Set a set of local configuration as complementary information to feature settings.
 void setStrict(String feature, Object target)
          Sets a feature to an object if the feature exists and the type is compatible.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

add

IFeatureManager add(String feature,
                    Object value)
Set a feature to a value.

Parameters:
feature - The feature name.
value - The value.
Returns:
The manager itself.

add

IFeatureManager add(String feature,
                    Object value,
                    boolean override)
Set a feature to a value.

Parameters:
feature - The feature name.
value - The value.
override - true, if the value should overwrite previous values, false, otherwise.
Returns:
The manager itself.

set

void set(String feature,
         Object target)
Sets a feature to an object if the feature exists and the type is compatible.

Parameters:
feature - The feature name.
target - The object where the feature must be set.

setStrict

void setStrict(String feature,
               Object target)
               throws FeatureManagerException
Sets a feature to an object if the feature exists and the type is compatible. Throws error if set is not possible.

Parameters:
feature - The feature name.
target - The object where the feature must be set.
Throws:
FeatureManagerException - On object setup.

setConfiguration

void setConfiguration(IConfiguration cfg)
Set a set of local configuration as complementary information to feature settings. When a instance of a ISpecRunner received a IConfiguration, this is set here as local and at the beginning of a new test execution it can be just replaced.

Parameters:
cfg - Set configuration features.

get

Object get(String key,
           Object defaultValue)
Get a value from map, if not found, result is 'defaultValue'.

Parameters:
key - A name.
defaultValue - The default value.
Returns:
The key value, or defaultValue, if not found.


Copyright © 2014. All rights reserved.