@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = SceneAccessLayer.THE_SCENE_IS_NOT_READABLE) public void testPlaybackNotReadable() throws IOException { Scene scene = EasyMock.createStrictMock(Scene.class); EasyMock.expect(scene.isReadable()).andReturn(false); SceneWriter sceneWriter = EasyMock.createStrictMock(SceneWriter.class); MatchRule matchRule = EasyMock.createStrictMock(MatchRule.class); RecordedHttpRequest incomingHttpRequest = EasyMock.createStrictMock(RecordedHttpRequest.class); EasyMock.replay(scene); SceneAccessLayer sceneAccessLayer = new SceneAccessLayer(scene, sceneWriter, matchRule); sceneAccessLayer.playback(incomingHttpRequest); EasyMock.verify(scene); }
public RecordedHttpResponse playback(RecordedHttpRequest request) { if (!_scene.isReadable()) { throw new IllegalStateException(THE_SCENE_IS_NOT_READABLE); } int position = findMatchRequest(request); if (position < 0) { throw new IllegalStateException(NO_MATCHING_RECORDING_FOUND); } if (_scene.isSequential()) { _sequencePosition++; } List<RecordedHttpExchange> recordedHttpExchangeList = _scene.getRecordedHttpExchangeList(); return recordedHttpExchangeList.get(position).getRecordedHttpResponse(); }
SceneAccessLayer { public RecordedHttpResponse playback(RecordedHttpRequest request) { if (!_scene.isReadable()) { throw new IllegalStateException(THE_SCENE_IS_NOT_READABLE); } int position = findMatchRequest(request); if (position < 0) { throw new IllegalStateException(NO_MATCHING_RECORDING_FOUND); } if (_scene.isSequential()) { _sequencePosition++; } List<RecordedHttpExchange> recordedHttpExchangeList = _scene.getRecordedHttpExchangeList(); return recordedHttpExchangeList.get(position).getRecordedHttpResponse(); } }
SceneAccessLayer { public RecordedHttpResponse playback(RecordedHttpRequest request) { if (!_scene.isReadable()) { throw new IllegalStateException(THE_SCENE_IS_NOT_READABLE); } int position = findMatchRequest(request); if (position < 0) { throw new IllegalStateException(NO_MATCHING_RECORDING_FOUND); } if (_scene.isSequential()) { _sequencePosition++; } List<RecordedHttpExchange> recordedHttpExchangeList = _scene.getRecordedHttpExchangeList(); return recordedHttpExchangeList.get(position).getRecordedHttpResponse(); } SceneAccessLayer(Scene scene, SceneWriter sceneWriter, MatchRule matchRule);  SceneAccessLayer(Scene scene, MatchRule matchRule);  SceneAccessLayer(); }
SceneAccessLayer { public RecordedHttpResponse playback(RecordedHttpRequest request) { if (!_scene.isReadable()) { throw new IllegalStateException(THE_SCENE_IS_NOT_READABLE); } int position = findMatchRequest(request); if (position < 0) { throw new IllegalStateException(NO_MATCHING_RECORDING_FOUND); } if (_scene.isSequential()) { _sequencePosition++; } List<RecordedHttpExchange> recordedHttpExchangeList = _scene.getRecordedHttpExchangeList(); return recordedHttpExchangeList.get(position).getRecordedHttpResponse(); } SceneAccessLayer(Scene scene, SceneWriter sceneWriter, MatchRule matchRule);  SceneAccessLayer(Scene scene, MatchRule matchRule);  SceneAccessLayer(); String getSceneName(); void setMatchRule(MatchRule matchRule); void setScene(Scene scene); boolean canPlayback(); boolean hasMatchRequest(RecordedHttpRequest request); RecordedHttpResponse playback(RecordedHttpRequest request); void record(RecordedHttpRequest recordedHttpRequest, RecordedHttpResponse recordedHttpResponse); void flush(); String getMatchFailureDescription(RecordedHttpRequest request); }
SceneAccessLayer { public RecordedHttpResponse playback(RecordedHttpRequest request) { if (!_scene.isReadable()) { throw new IllegalStateException(THE_SCENE_IS_NOT_READABLE); } int position = findMatchRequest(request); if (position < 0) { throw new IllegalStateException(NO_MATCHING_RECORDING_FOUND); } if (_scene.isSequential()) { _sequencePosition++; } List<RecordedHttpExchange> recordedHttpExchangeList = _scene.getRecordedHttpExchangeList(); return recordedHttpExchangeList.get(position).getRecordedHttpResponse(); } SceneAccessLayer(Scene scene, SceneWriter sceneWriter, MatchRule matchRule);  SceneAccessLayer(Scene scene, MatchRule matchRule);  SceneAccessLayer(); String getSceneName(); void setMatchRule(MatchRule matchRule); void setScene(Scene scene); boolean canPlayback(); boolean hasMatchRequest(RecordedHttpRequest request); RecordedHttpResponse playback(RecordedHttpRequest request); void record(RecordedHttpRequest recordedHttpRequest, RecordedHttpResponse recordedHttpResponse); void flush(); String getMatchFailureDescription(RecordedHttpRequest request);  }