All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.accenture.testing.bdd.parameters.ResponseCacheTransform Maven / Gradle / Ivy

Go to download

A simple to use, easy to integrate, BDD library for API and microservices development.

The newest version!
package com.accenture.testing.bdd.parameters;

import com.accenture.testing.bdd.http.ResponseState;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode
public class ResponseCacheTransform extends ParamTransform {

  String key;

  public ResponseCacheTransform(String key) {
    this.key = key;
  }

  @Override
  String key() {
    return key;
  }

  @Override
  String transform(String params, ParamTransformer pt) {
    String[] pieces = params.split("->");
    ResponseState rs = pt.getResponseState(pieces[0]);

    if (key().contains(".header")) {
      return rs.getResponse().getHeader(pieces[1]);
    }

    return rs.getValue(pt, pieces[1]).toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy