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

io.github.carousell.cucumber2junit.model.Feature Maven / Gradle / Ivy

Go to download

Generates plain JUnit tests from Gherkin feature files. This is useful when you want to execute Cucumber tests in an environment which does not allow custom JUnit runners, e.g. the AWS Device Farm.

The newest version!
package io.github.carousell.cucumber2junit.model;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import java.util.List;

/**
 * DTO for Gherkin features. As of version 1.3 we do not support feature level tags anymore. All
 * tags will be loaded from an external datasource based on a scenario id
 */
public class Feature {

  private String name;

  private String fileName;

  private List scenarios;

  /**
   * Constructor.
   *
   * @param name feature name
   * @param fileName the file name of the feature
   * @param scenarios {@link List} of scenarios
   */
  public Feature(String name, String fileName, List scenarios) {
    super();
    this.name = name;
    this.fileName = fileName;
    this.scenarios = scenarios;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public List getScenarios() {
    return scenarios;
  }

  public void setScenarios(List scenarios) {
    this.scenarios = scenarios;
  }

  public String getFileName() {
    return fileName;
  }

  public void setFileName(String fileName) {
    this.fileName = fileName;
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(name, scenarios, fileName);
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }
    if (obj == this) {
      return true;
    }
    if (obj.getClass() != getClass()) {
      return false;
    }
    Feature other = (Feature) obj;
    return Objects.equal(this.name, other.name)
        && Objects.equal(this.scenarios, other.scenarios)
        && Objects.equal(this.fileName, other.fileName);
  }

  @Override
  public String toString() {
    return MoreObjects.toStringHelper(this)
        .add("name", name)
        .add("scenarios", scenarios)
        .add("fileName", fileName)
        .toString();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy