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

generator.server.springboot.cucumber.rest.AsyncElementAsserter.mustache Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package {{packageName}}.cucumber.rest;

import java.time.Duration;
import java.util.Collection;
import java.util.List;
import java.util.Map;

class AsyncElementAsserter implements ElementAsserter {

  private final Duration maxTime;
  private final AsyncResponseAsserter responseAsserter;
  private final ElementAssertions assertions;

  AsyncElementAsserter(AsyncResponseAsserter responseAsserter, String jsonPath, Duration maxTime) {
    this.responseAsserter = responseAsserter;
    this.maxTime = maxTime;
    assertions = new ElementAssertions(jsonPath);
  }

  @Override
  public AsyncElementAsserter withValues(Collection values) {
    Awaiter.await(maxTime, () -> assertions.withValues(values));

    return this;
  }

  @Override
  public AsyncElementAsserter withElementsCount(int count) {
    Awaiter.await(maxTime, () -> assertions.withElementsCount(count));

    return this;
  }

  @Override
  public AsyncElementAsserter withMoreThanElementsCount(int count) {
    Awaiter.await(maxTime, () -> assertions.withMoreThanElementsCount(count));

    return this;
  }

  @Override
  public AsyncElementAsserter withValue(Object value) {
    Awaiter.await(maxTime, () -> assertions.withValue(value));

    return this;
  }

  @Override
  public  AsyncElementAsserter containingExactly(List> responses) {
    Awaiter.await(maxTime, () -> assertions.containingExactly(responses));

    return this;
  }

  @Override
  public  AsyncElementAsserter containing(Map response) {
    Awaiter.await(maxTime, () -> assertions.containing(response));

    return this;
  }

  @Override
  public  AsyncElementAsserter containing(List> responses) {
    Awaiter.await(maxTime, () -> assertions.containing(responses));

    return this;
  }

  @Override
  public AsyncResponseAsserter and() {
    return responseAsserter;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy