// Path: src/main/java/org/wmaop/aop/interceptor/FlowPosition.java
// public class FlowPosition {
// 
// 	public final String packageName;
// 	public final String serviceName;
// 	public final String fqname;
// 	private InterceptPoint interceptPoint;
// 	
// 	public FlowPosition(InterceptPoint point, String fqname) {
// 		interceptPoint = point;
// 		if (fqname == null) {
// 			serviceName = "";
// 			packageName = "";
// 			this.fqname = "";
// 		} else {
// 			this.fqname = fqname;
// 			int pkgsep = fqname.lastIndexOf(':');
// 			if (pkgsep == -1) {
// 				serviceName = fqname;
// 				packageName = "";
// 			} else {
// 				serviceName = fqname.substring(pkgsep + 1);
// 				packageName = fqname.substring(0, pkgsep);
// 			}
// 		}
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return fqname;
// 	}
// 
// 	public void setInterceptPoint(InterceptPoint point) {
// 		interceptPoint = point;
// 	}
// 
// 	public InterceptPoint getInterceptPoint() {
// 		return interceptPoint;
// 	}
// 
// 	public String getPackageName() {
// 		return packageName;
// 	}
// 
// 	public String getServiceName() {
// 		return serviceName;
// 	}
// 
// 	public String getFqname() {
// 		return fqname;
// 	}
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/InterceptResult.java
// public class InterceptResult {
// 	
// 	public static final InterceptResult TRUE = new InterceptResult(true);
// 	public static final InterceptResult FALSE = new InterceptResult(false);
// 
// 	private final boolean hasIntercepted;
// 	private final Exception exception;
// 
// 	public InterceptResult(boolean hasIntercepted) {
// 		this.hasIntercepted = hasIntercepted;
// 		exception = null;
// 	}
// 
// 	public InterceptResult(boolean hasIntercepted, Exception e) {
// 		this.exception = e;
// 		this.hasIntercepted = hasIntercepted;
// 	}
// 
// 	public boolean hasIntercepted() {
// 		return hasIntercepted;
// 	}
// 
// 	public Exception getException() {
// 		return exception;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/org/wmaop/interceptor/mock/canned/CannedResponseInterceptor.java
// public enum ResponseSequence {
// 	SEQUENTIAL, RANDOM;
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.mockito.Mockito;
import org.wmaop.aop.interceptor.FlowPosition;
import org.wmaop.aop.interceptor.InterceptResult;
import org.wmaop.interceptor.mock.canned.CannedResponseInterceptor.ResponseSequence;
import com.wm.data.IData;
import com.wm.data.IDataCursor;
import com.wm.data.IDataUtil;
import com.wm.data.ISMemDataImpl;
package org.wmaop.interceptor.mock.canned;





public class CannedResponseInterceptorTest {

	private String A_IDATA = "<IDataXMLCoder version=\"1.0\"><record javaclass=\"com.wm.data.ISMemDataImpl\"><value name=\"akey\">avalue</value></record></IDataXMLCoder>";
	
	@Test
	public void shouldLoadFromStream() throws IOException {
		IData pipeline = getIData(new String[][]{{"bkey", "bvalue"}});
		FlowPosition flowPosition = Mockito.mock(FlowPosition.class);
		ByteArrayInputStream bais = new ByteArrayInputStream(A_IDATA.getBytes());
		InterceptResult ir = new CannedResponseInterceptor(bais).intercept(flowPosition , pipeline);
		verifyMerged(pipeline, ir);
	}
	
	@Test
	public void shouldLoadFromString() throws IOException {
		IData pipeline = getIData(new String[][]{{"bkey", "bvalue"}});
		FlowPosition flowPosition = Mockito.mock(FlowPosition.class);
		InterceptResult ir = new CannedResponseInterceptor(A_IDATA).intercept(flowPosition , pipeline);
		verifyMerged(pipeline, ir);
	}

// Path: src/main/java/org/wmaop/aop/interceptor/FlowPosition.java
// public class FlowPosition {
// 
// 	public final String packageName;
// 	public final String serviceName;
// 	public final String fqname;
// 	private InterceptPoint interceptPoint;
// 	
// 	public FlowPosition(InterceptPoint point, String fqname) {
// 		interceptPoint = point;
// 		if (fqname == null) {
// 			serviceName = "";
// 			packageName = "";
// 			this.fqname = "";
// 		} else {
// 			this.fqname = fqname;
// 			int pkgsep = fqname.lastIndexOf(':');
// 			if (pkgsep == -1) {
// 				serviceName = fqname;
// 				packageName = "";
// 			} else {
// 				serviceName = fqname.substring(pkgsep + 1);
// 				packageName = fqname.substring(0, pkgsep);
// 			}
// 		}
// 	}
// 	
// 	@Override
// 	public String toString() {
// 		return fqname;
// 	}
// 
// 	public void setInterceptPoint(InterceptPoint point) {
// 		interceptPoint = point;
// 	}
// 
// 	public InterceptPoint getInterceptPoint() {
// 		return interceptPoint;
// 	}
// 
// 	public String getPackageName() {
// 		return packageName;
// 	}
// 
// 	public String getServiceName() {
// 		return serviceName;
// 	}
// 
// 	public String getFqname() {
// 		return fqname;
// 	}
// }
// 
// Path: src/main/java/org/wmaop/aop/interceptor/InterceptResult.java
// public class InterceptResult {
// 	
// 	public static final InterceptResult TRUE = new InterceptResult(true);
// 	public static final InterceptResult FALSE = new InterceptResult(false);
// 
// 	private final boolean hasIntercepted;
// 	private final Exception exception;
// 
// 	public InterceptResult(boolean hasIntercepted) {
// 		this.hasIntercepted = hasIntercepted;
// 		exception = null;
// 	}
// 
// 	public InterceptResult(boolean hasIntercepted, Exception e) {
// 		this.exception = e;
// 		this.hasIntercepted = hasIntercepted;
// 	}
// 
// 	public boolean hasIntercepted() {
// 		return hasIntercepted;
// 	}
// 
// 	public Exception getException() {
// 		return exception;
// 	}
// 	
// 	
// }
// 
// Path: src/main/java/org/wmaop/interceptor/mock/canned/CannedResponseInterceptor.java
// public enum ResponseSequence {
// 	SEQUENTIAL, RANDOM;
// }


// Path: src/test/java/org/wmaop/interceptor/mock/canned/CannedResponseInterceptorTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.mockito.Mockito;
import org.wmaop.aop.interceptor.FlowPosition;
import org.wmaop.aop.interceptor.InterceptResult;
import org.wmaop.interceptor.mock.canned.CannedResponseInterceptor.ResponseSequence;
import com.wm.data.IData;
import com.wm.data.IDataCursor;
import com.wm.data.IDataUtil;
import com.wm.data.ISMemDataImpl;

package org.wmaop.interceptor.mock.canned;





public class CannedResponseInterceptorTest {

	private String A_IDATA = "<IDataXMLCoder version=\"1.0\"><record javaclass=\"com.wm.data.ISMemDataImpl\"><value name=\"akey\">avalue</value></record></IDataXMLCoder>";
	
	@Test
	public void shouldLoadFromStream() throws IOException {
		IData pipeline = getIData(new String[][]{{"bkey", "bvalue"}});
		FlowPosition flowPosition = Mockito.mock(FlowPosition.class);
		ByteArrayInputStream bais = new ByteArrayInputStream(A_IDATA.getBytes());
		InterceptResult ir = new CannedResponseInterceptor(bais).intercept(flowPosition , pipeline);
		verifyMerged(pipeline, ir);
	}
	
	@Test
	public void shouldLoadFromString() throws IOException {
		IData pipeline = getIData(new String[][]{{"bkey", "bvalue"}});
		FlowPosition flowPosition = Mockito.mock(FlowPosition.class);
		InterceptResult ir = new CannedResponseInterceptor(A_IDATA).intercept(flowPosition , pipeline);
		verifyMerged(pipeline, ir);
	}

	@Test