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

org.needle4j.junit.testrule.NeedleTestRuleBuilder Maven / Gradle / Ivy

Go to download

Needle is a lightweight framework for testing Java EE components outside of the container in isolation. It reduces the test setup code by analysing dependencies and automatic injection of mock objects. It will thus maximize the speed of development as well as the execution of unit tests.

The newest version!
package org.needle4j.junit.testrule;

import org.needle4j.injection.InjectionConfiguration;
import org.needle4j.injection.InjectionProvider;
import org.needle4j.junit.AbstractNeedleRuleBuilder;

/**
 * Builder that created a new {@link NeedleTestRule}.
 */
public class NeedleTestRuleBuilder extends AbstractNeedleRuleBuilder {
  private final Object testInstance;

  /**
   * Create new instance.
   *
   * @param testInstance the test instance containing the rule, normally "this"
   */
  public NeedleTestRuleBuilder(final Object testInstance) {
    this.testInstance = testInstance;
  }

  @Override
  protected NeedleTestRule build(final InjectionConfiguration injectionConfiguration,
                                 final InjectionProvider... injectionProvider) {
    return new NeedleTestRule(testInstance, injectionConfiguration, injectionProvider);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy