package com.greghaskins.spectrum.internal;

import static com.greghaskins.spectrum.model.BlockConfiguration.Factory.defaultPreconditions;

import com.greghaskins.spectrum.Block;
import com.greghaskins.spectrum.Spectrum;
import com.greghaskins.spectrum.model.BlockConfiguration;

import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;

public interface Child {

  Description getDescription();

  void run(RunNotifier notifier);

  int testCount();

  void focus();

  void ignore();

  /**
   * Is either this child ignored or are all of its children ignored.
   * @return true if nothing will run from here
   */
  boolean isEffectivelyIgnored();

  /**
   * Is this child something which runs as a test.
   * @return if the child is atomic
   */
  default boolean isAtomic() {
    return false;
  }

  /**
   * Gets the object to be filtered appropriately with its preconditions.
   * @param block the block that will be executed by the child - this may be of
   *              type {@link ConfiguredBlock} if declared with
   *              {@link Spectrum#with(BlockConfiguration, Block)}
   * @param taggingFilterCriteria the tagging state in the parent of this suite or spec.
   *                     This is used to determine what filters apply to the block
   * @return the child itself for fluent calling
   */
  default Child applyPreconditions(final Block block,
      final TaggingFilterCriteria taggingFilterCriteria) {
    ConfiguredBlock.findApplicablePreconditions(block).applyTo(this, taggingFilterCriteria);

    return this;
  }

  /**
   * Provide the precondition object for this child's block, which are
   * either in the block itself, or provided as a default.
   * @param block the block which may have preconditions
   * @return a non null preconditions object to use
   */
  static BlockConfiguration findApplicablePreconditions(final Block block) {
    if (block instanceof ConfiguredBlock) {
      return ((ConfiguredBlock) block).getPreconditions();
    } else {
      return defaultPreconditions();
    }
  }
}

@@ -41,103 +41,8 @@
 l;%0A%0A
-import static com.greghaskins.spectrum.model.BlockConfiguration.Factory.defaultPreconditions;%0A%0A
 impo
@@ -1481,499 +1481,7 @@
 %0A  %7D
-%0A%0A  /**%0A   * Provide the precondition object for this child's block, which are%0A   * either in the block itself, or provided as a default.%0A   * @param block the block which may have preconditions%0A   * @return a non null preconditions object to use%0A   */%0A  static BlockConfiguration findApplicablePreconditions(final Block block) %7B%0A    if (block instanceof ConfiguredBlock) %7B%0A      return ((ConfiguredBlock) block).getPreconditions();%0A    %7D else %7B%0A      return defaultPreconditions();%0A    %7D%0A  %7D
 %0A%7D%0A

Remove dead code, was moved elsewhere