Skip to content

Instantly share code, notes, and snippets.

public final class SpecificationLifecycleImpl implements SpecificationLifecycle {
public <T extends Throwable> Either<T, ContextClass> createContext() {
throw new UnsupportedOperationException();
}
public <T extends Throwable> Either<T, Unit> resetMockery() {
throw new UnsupportedOperationException();
}
public <T extends Throwable> Either<T, Unit> wireActors() {
@tomjadams
tomjadams / ASpecificationLifecycleResultDeterminatorWithAMockFailure.java
Created August 1, 2008 03:53
Finding a specification result using Either
package com.googlecode.instinct.internal.runner;
import static com.googlecode.instinct.expect.Expect.expect;
import com.googlecode.instinct.integrate.junit4.InstinctRunner;
import com.googlecode.instinct.marker.annotate.BeforeSpecification;
import com.googlecode.instinct.marker.annotate.Dummy;
import com.googlecode.instinct.marker.annotate.Specification;
import com.googlecode.instinct.marker.annotate.Stub;
import com.googlecode.instinct.marker.annotate.Subject;
import fj.Unit;
private SpecificationResult runLifecycle(final long startTime, final SpecificationLifecycle lifecycle,
final SpecificationMethod specificationMethod) {
List<Option<Throwable>> lifecycleStepErrors = nil();
final Either<Throwable, ContextClass> createContextResult = lifecycle.createContext(specificationMethod.getContextClass());
lifecycleStepErrors = lifecycleStepErrors.cons(createContextResult.left().toOption());
if (createContextResult.isLeft()) {
return fail(startTime, specificationMethod, somes(lifecycleStepErrors), false);
} else {
final ContextClass contextClass = createContextResult.right().value();
final Option<Throwable> contextValidationResult = methodValidator.checkContextConstructor(contextClass.getType());
package com.googlecode.furnace.parse
import sequence.GeneSequence
import scala.collection.mutable.{ArrayBuffer => MutableArray}
import scalaz.list.NonEmptyList, NonEmptyList._
import sequence.{Base, GeneSequence}
import sequence.Base._
import sequence.GeneSequence._
/**
scala> val list = List(1, 2, 3, 4, 5, 6, 7, 8, 9)
list: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9)
scala> val iter = list.elements
iter: Iterator[Int] = non-empty iterator
scala> val firstTwoElements = iter.filter(_ < 5).zipWithIndex.takeWhile(_._2 < 2).map(_._1).toList
firstTwoElements: List[Int] = List(1, 2)
scala> assert(iter.toList == List(3, 4, 5, 6, 7, 8, 9))
object CommandLineBlast {
lazy val blastHome = getenv("BLAST_HOME")
lazy val tmpDir = getProperty("java.io.tmpdir")
def blast(config: BlastConfiguration): AnalysisResult = {
if (blastHome == null) {
error("BLAST_HOME is not defined. It must point to the BLAST installation directory, e.g. BLAST_HOME=/opt/blast")
} else {
val executable = blastHome + "/bin/" + config.searchUtility.name
val c = command(executable)("-p", config.program.name)("-e 1.0")("-d ecoli.nt")("-i test.txt")("-o test.out")
package com.googlecode.furnace.analyse.blast;
import static com.googlecode.instinct.expect.Expect.expect;
import com.googlecode.instinct.integrate.junit4.InstinctRunner;
import com.googlecode.instinct.internal.util.instance.ObjectFactory;
import com.googlecode.instinct.marker.annotate.BeforeSpecification;
import com.googlecode.instinct.marker.annotate.Dummy;
import com.googlecode.instinct.marker.annotate.Mock;
import com.googlecode.instinct.marker.annotate.Specification;
import com.googlecode.instinct.marker.annotate.Subject;
CmdUtils.CreateCommand({
name: "showmore",
takes: {"url to shorten": noun_arb_text},
preview: "Replaces the selected URL with ashowmore.info shortened URL.",
description: "Replaces the selected URL with a bit.ly-shortened URL.",
icon: "http://bit.ly/favicon.png",
execute: function( urlToShorten ) {
var baseUrl = "http://showmore.info/links/";
var params = {link_url: urlToShorten.text};
jQuery.get(baseUrl, params, function(shortenedUrl) {
<property name="project.longname" value="Instinct Behaviour Driven Development (BDD) Framework"/>
<property name="project.shortname" value="instinct-core"/>
<property name="project.version.major" value="0"/>
<property name="project.version.minor" value="2.0"/>
<property name="version-status" value=""/>
<property name="project.version.full" value="${project.version.major}.${project.version.minor}${version-stat
us}"/>
<property name="project.jar" value="${project.shortname}-${project.version.full}.jar"/>
<property name="project.zip" value="${project.shortname}-${project.version.full}.zip"/>
package com.googlecode.furnace.grid
import org.gridgain.grid.{GridTaskSplitAdapter, GridJobResult, GridJob}
import analyse.{AnalysisResult, SequenceIdentifier}
import java.util.{List => JavaList}
import java.util.{Collection => JavaCollection}
import sequence.GeneSequence
final class GeneSequenceGridTask extends GridTaskSplitAdapter[Iterator[GeneSequence], List[AnalysisResult]] {
def split(gridSize: Int, inputSequences: Iterator[GeneSequence]): JavaCollection[_ <: GridJob] = error("I'm not really a list")