// Path: src/test/java/com/asolutions/MockTestCase.java
// public class MockTestCase {
// 
// 	protected Mockery context = new JUnit4Mockery();
// 
// 	@Before
// 	public void setupMockery() {
// 		context.setImposteriser(ClassImposteriser.INSTANCE);
// 	}
// 	
// 	@After
// 	public void mockeryAssertIsSatisfied(){
// 		context.assertIsSatisfied();
// 	}
// 
// 	protected void checking(Expectations expectations) {
// 		context.checking(expectations);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/NoOpCommand.java
// public class NoOpCommand implements Command {
// 	protected final Logger log = LoggerFactory.getLogger(getClass());
// 	private ExitCallback callback;
// 
// 	public void setErrorStream(OutputStream err) {
// 	}
// 
// 	public void setExitCallback(ExitCallback callback) {
// 		this.callback = callback;
// 	}
// 
// 	public void setInputStream(InputStream in) {
// 	}
// 
// 	public void setOutputStream(OutputStream out) {
// 	}
// 
// 	public void start() throws IOException {
// 		log.info("Executing No Op Command");
// 		callback.onExit(-1);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/filters/BadCommandException.java
// public class BadCommandException extends Exception {
// 
// 	private static final long serialVersionUID = 4904880805323643780L;
// 
// 	public BadCommandException(String reason) {
// 		super(reason);
// 	}
// 
// 	public BadCommandException() {
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/filters/IBadCommandFilter.java
// public interface IBadCommandFilter {
// 
// 	FilteredCommand filterOrThrow(String command) throws BadCommandException;
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/converters/path/IPathToProjectNameConverter.java
// public interface IPathToProjectNameConverter {
// 
// 	public abstract String convert(String toParse)
// 			throws UnparsableProjectException;
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/sshd/IProjectAuthorizer.java
// public interface IProjectAuthorizer {
// 
// 	AuthorizationLevel userIsAuthorizedForProject(String username, String project) throws UnparsableProjectException;
// 
// }


import static org.junit.Assert.assertEquals;
import java.util.Properties;
import org.jmock.Expectations;
import org.junit.Test;
import com.asolutions.MockTestCase;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.NoOpCommand;
import com.asolutions.scmsshd.commands.filters.BadCommandException;
import com.asolutions.scmsshd.commands.filters.IBadCommandFilter;
import com.asolutions.scmsshd.converters.path.IPathToProjectNameConverter;
import com.asolutions.scmsshd.sshd.IProjectAuthorizer;

package com.asolutions.scmsshd.commands.factories;





public class CommandFactoryBaseTest  extends MockTestCase {
	
	private static final String ARGUMENT = "argument";
	private static final String COMMAND = "command";
	
	@Test
	public void testBadCommandReturnsNoOp() throws Exception {
		final IBadCommandFilter mockBadCommandFilter = context.mock(IBadCommandFilter.class);
		checking(new Expectations(){{
			one(mockBadCommandFilter).filterOrThrow(COMMAND);
			will(throwException(new BadCommandException()));
		}});
		
		CommandFactoryBase factory = new CommandFactoryBase();
		factory.setBadCommandFilter(mockBadCommandFilter);
		assertEquals(NoOpCommand.class, factory.createCommand(COMMAND).getClass());
	}
	
	@Test
	public void testChecksBadCommandFirst() throws Exception {

// Path: src/test/java/com/asolutions/MockTestCase.java
// public class MockTestCase {
// 
// 	protected Mockery context = new JUnit4Mockery();
// 
// 	@Before
// 	public void setupMockery() {
// 		context.setImposteriser(ClassImposteriser.INSTANCE);
// 	}
// 	
// 	@After
// 	public void mockeryAssertIsSatisfied(){
// 		context.assertIsSatisfied();
// 	}
// 
// 	protected void checking(Expectations expectations) {
// 		context.checking(expectations);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/FilteredCommand.java
// public class FilteredCommand {
// 	
// 	private String command;
// 	private String argument;
// 
// 	public FilteredCommand() {
// 	}
// 	
// 	public FilteredCommand(String command, String argument) {
// 		this.command = command;
// 		this.argument = argument;
// 	}
// 
// 	public void setArgument(String argument) {
// 		this.argument = argument;
// 	}
// 	
// 	public void setCommand(String command) {
// 		this.command = command;
// 	}
// 
// 	public String getCommand() {
// 		return this.command;
// 	}
// 
// 	public String getArgument() {
// 		return this.argument;
// 	}
// 	
// 	@Override
// 	public String toString()
// 	{
// 		return "Filtered Command: " + getCommand() + ", " + getArgument();
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/NoOpCommand.java
// public class NoOpCommand implements Command {
// 	protected final Logger log = LoggerFactory.getLogger(getClass());
// 	private ExitCallback callback;
// 
// 	public void setErrorStream(OutputStream err) {
// 	}
// 
// 	public void setExitCallback(ExitCallback callback) {
// 		this.callback = callback;
// 	}
// 
// 	public void setInputStream(InputStream in) {
// 	}
// 
// 	public void setOutputStream(OutputStream out) {
// 	}
// 
// 	public void start() throws IOException {
// 		log.info("Executing No Op Command");
// 		callback.onExit(-1);
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/filters/BadCommandException.java
// public class BadCommandException extends Exception {
// 
// 	private static final long serialVersionUID = 4904880805323643780L;
// 
// 	public BadCommandException(String reason) {
// 		super(reason);
// 	}
// 
// 	public BadCommandException() {
// 	}
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/commands/filters/IBadCommandFilter.java
// public interface IBadCommandFilter {
// 
// 	FilteredCommand filterOrThrow(String command) throws BadCommandException;
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/converters/path/IPathToProjectNameConverter.java
// public interface IPathToProjectNameConverter {
// 
// 	public abstract String convert(String toParse)
// 			throws UnparsableProjectException;
// 
// }
// 
// Path: src/main/java/com/asolutions/scmsshd/sshd/IProjectAuthorizer.java
// public interface IProjectAuthorizer {
// 
// 	AuthorizationLevel userIsAuthorizedForProject(String username, String project) throws UnparsableProjectException;
// 
// }


// Path: src/test/java/com/asolutions/scmsshd/commands/factories/CommandFactoryBaseTest.java
import static org.junit.Assert.assertEquals;
import java.util.Properties;
import org.jmock.Expectations;
import org.junit.Test;
import com.asolutions.MockTestCase;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.NoOpCommand;
import com.asolutions.scmsshd.commands.filters.BadCommandException;
import com.asolutions.scmsshd.commands.filters.IBadCommandFilter;
import com.asolutions.scmsshd.converters.path.IPathToProjectNameConverter;
import com.asolutions.scmsshd.sshd.IProjectAuthorizer;

package com.asolutions.scmsshd.commands.factories;





public class CommandFactoryBaseTest  extends MockTestCase {
	
	private static final String ARGUMENT = "argument";
	private static final String COMMAND = "command";
	
	@Test
	public void testBadCommandReturnsNoOp() throws Exception {
		final IBadCommandFilter mockBadCommandFilter = context.mock(IBadCommandFilter.class);
		checking(new Expectations(){{
			one(mockBadCommandFilter).filterOrThrow(COMMAND);
			will(throwException(new BadCommandException()));
		}});
		
		CommandFactoryBase factory = new CommandFactoryBase();
		factory.setBadCommandFilter(mockBadCommandFilter);
		assertEquals(NoOpCommand.class, factory.createCommand(COMMAND).getClass());
	}
	
	@Test
	public void testChecksBadCommandFirst() throws Exception {

		final IBadCommandFilter mockBadCommandFilter = context.mock(IBadCommandFilter.class);
