public String namespaceString ( String plainString ) throws RuntimeException { if ( plainString . startsWith ( NAME_SPACE_PREFIX ) ) { return ( plainString . replace ( NAME_SPACE_PREFIX , nameSpaceThreadLocale . get ( ) ) ) ; } if ( plainString . startsWith ( SCENARIO_NAME_SPACE_PREFIX ) ) { if ( cucumberManager . getCurrentScenarioGlobals ( ) == null ) { throw new ScenarioNameSpaceAccessOutsideScenarioScopeException ( "You cannot fetch a Scneario namespace outside the scope of a scenario" ) ; } return ( plainString . replace ( SCENARIO_NAME_SPACE_PREFIX , cucumberManager . getCurrentScenarioGlobals ( ) . getNameSpace ( ) ) ) ; } else { return plainString ; } }
Extends the name space prefix with the actual name space All tests that need to ensure privacy i . e . no other test shall mess up their data shall use name spacing . Data that can be messed up by other tests and there fore needs to be unique shall contain the name space prefix that will be replaced at run time .