}
@SuppressWarnings("unchecked")
protected StubHttpLifecycle mapRootYamlNodeToStub(final LinkedHashMap<String, Object> parentNode) throws Exception {
final StubHttpLifecycle stubHttpLifecycle = new StubHttpLifecycle();
for (final Map.Entry<String, Object> parent : parentNode.entrySet()) {
if (parent.getValue() instanceof LinkedHashMap) {
final Object targetStub = parent.getKey().equals(YAML_NODE_REQUEST) ? new StubRequest() : new StubResponse();
final Object populatedTargetStub = mapPairValueToRespectiveField(targetStub, (LinkedHashMap<String, Object>) parent.getValue());
if (parent.getKey().equals(YAML_NODE_REQUEST)) {
stubHttpLifecycle.setRequest((StubRequest) populatedTargetStub);
} else {
stubHttpLifecycle.setResponse(populatedTargetStub);
}
} else if (parent.getValue() instanceof ArrayList) {
final Object populatedResponseStub = mapPairValueToRespectiveField((ArrayList) parent.getValue());
stubHttpLifecycle.setResponse(populatedResponseStub);
}
}
return stubHttpLifecycle;
}