Buggy code:
@ RunWith ( Arquillian . class ) @ RunAsClient public class JSFFailoverTestCase extends ClusterAbstractTestCase { @ Deployment ( name = DEPLOYMENT_1 , managed = false , testable = false ) @ TargetsContainer ( CONTAINER_1 ) public static Archive < ? > deployment0 ( ) { } @ Deployment ( name = DEPLOYMENT_2 , managed = false , testable = false ) @ TargetsContainer ( CONTAINER_2 ) public static Archive < ? > deployment1 ( ) { } private static Archive < ? > createDeployment ( ) { } @ Override protected void setUp ( ) { } private static JSFFailoverTestCase . NumberGuessState parseState ( HttpResponse response , String sessionId ) throws IOException , IllegalStateException { Pattern smallestPattern = Pattern . compile ( "<span<seq2seq4repair_space>id=\"numberGuess:smallest\">([^<]+)<//span>" ) ; Pattern biggestPattern = Pattern . compile ( "<span<seq2seq4repair_space>id=\"numberGuess:biggest\">([^<]+)<//span>" ) ; Pattern remainingPattern = Pattern . compile ( "You<seq2seq4repair_space>have<seq2seq4repair_space>(\\d+)<seq2seq4repair_space>guesses<seq2seq4repair_space>remaining." ) ; <START_BUG> Pattern viewStatePattern = Pattern . compile ( "id=\"javax.faces.ViewState\"<seq2seq4repair_space>value=\"([^\"]*)\"" ) ; <END_BUG> Matcher matcher ; JSFFailoverTestCase . NumberGuessState state = new JSFFailoverTestCase . NumberGuessState ( ) ; String responseString = IOUtils . toString ( response . getEntity ( ) . getContent ( ) , "UTF-8" ) ; Header setCookie = response . getFirstHeader ( "Set-Cookie" ) ; if ( setCookie != null ) { String setCookieValue = setCookie . getValue ( ) ; state . sessionId = setCookieValue . substring ( ( ( setCookieValue . indexOf ( '=' ) ) + 1 ) , setCookieValue . indexOf ( ';' ) ) ; } else if ( sessionId != null ) { state . sessionId = sessionId ; } matcher = smallestPattern . matcher ( responseString ) ; if ( matcher . find ( ) ) { state . smallest = matcher . group ( 1 ) ; } matcher = biggestPattern . matcher ( responseString ) ; if ( matcher . find ( ) ) { state . biggest = matcher . group ( 1 ) ; } matcher = remainingPattern . matcher ( responseString ) ; if ( matcher . find ( ) ) { state . remainingGuesses = matcher . group ( 1 ) ; } matcher = viewStatePattern . matcher ( responseString ) ; if ( matcher . find ( ) ) { state . jsfViewState = matcher . group ( 1 ) ; } return state ; } private static HttpUriRequest buildPostRequest ( String url , String sessionId , String viewState , String guess ) throws UnsupportedEncodingException { } private static HttpUriRequest buildGetRequest ( String url , String sessionId ) { } @ Test @ InSequence ( 1 ) public void testGracefulSimpleFailover ( @ ArquillianResource @ OperateOnDeployment ( DEPLOYMENT_1 ) URL baseURL1 , @ ArquillianResource @ OperateOnDeployment ( DEPLOYMENT_2 ) URL baseURL2 ) throws IOException , InterruptedException , URISyntaxException { } @ Test @ InSequence ( 2 ) public void testGracefulUndeployFailover ( @ ArquillianResource @ OperateOnDeployment ( DEPLOYMENT_1 ) URL baseURL1 , @ ArquillianResource @ OperateOnDeployment ( DEPLOYMENT_2 ) URL baseURL2 ) throws IOException , InterruptedException , URISyntaxException { } @ Test @ InSequence ( 3 ) public void testUndeploy ( ) { } private static class NumberGuessState { String smallest ; String biggest ; String sessionId ; String remainingGuesses ; String jsfViewState ; } private void establishView ( HttpClient client , URL baseURL , String ... members ) throws IOException , URISyntaxException { } }

Fix:
Pattern viewStatePattern = Pattern . compile ( "id=\".*javax.faces.ViewState.*\"<seq2seq4repair_space>value=\"([^\"]*)\"" ) ;