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

com.tngtech.jgiven.base.DualScenarioTestBase Maven / Gradle / Ivy

There is a newer version: 1.3.1
Show newest version
package com.tngtech.jgiven.base;

import com.google.common.reflect.TypeToken;
import com.tngtech.jgiven.impl.Scenario;


/**
 * ScenarioTest that only takes two type parameters, where the first is used for combined
 * GIVEN and WHEN and the second is used for THEN.
 *
 * This is useful for tests, where you often need to use WHEN steps also in GIVEN statements.
 *
 * This class is typically not directly used by end users,
 * but instead test-framework-specific classes for JUnit or TestNG
 */
public abstract class DualScenarioTestBase extends ScenarioTestBase {

  @SuppressWarnings( { "serial", "unchecked" } )
  protected Scenario createScenario() {
    Class givenWhenClass = (Class) new TypeToken( getClass() ) {}.getRawType();
    Class thenClass = (Class) new TypeToken( getClass() ) {}.getRawType();

    return new Scenario<>(givenWhenClass, givenWhenClass, thenClass);
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy