Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * OfficeFloor - http://www.officefloor.net
  * Copyright (C) 2005-2011 Daniel Sagenschneider
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.officefloor.compile.impl.work;
Class for net.officefloor.plugin.work.clazz.ClassWorkSource that enables validating loading a net.officefloor.compile.work.WorkType.

Author(s):
Daniel Sagenschneider
public class MockLoadWork {

Asserts the loaded net.officefloor.compile.work.WorkType is correct.

Parameters:
workType net.officefloor.compile.work.WorkType to validate.
	public static void assertWorkType(WorkType<?> workType) {
		// Ensure correct number of tasks
		TestCase.assertEquals("Incorrect number of tasks", 2, workType
				.getTaskTypes().length);
		// Ensure correct first task
		TaskType<?, ?, ?> taskOne = workType.getTaskTypes()[0];
		TestCase.assertEquals("Incorrect first task""assertWorkType"taskOne
		TestCase.assertEquals("Incorrect number of flows", 0, taskOne
				.getFlowTypes().length);
		TestCase.assertEquals("Incorrect number of objects", 1, taskOne
				.getObjectTypes().length);
		TestCase.assertEquals("Incorrect object type"WorkType.classtaskOne
		TestCase.assertEquals("Incorrect number of escalations", 0, taskOne
		// Ensure correct second task
		TaskType<?, ?, ?> taskTwo = workType.getTaskTypes()[1];
		TestCase.assertEquals("Incorrect second task""doTask"taskTwo
		TestCase.assertEquals("Incorrect number of flows", 0, taskTwo
				.getFlowTypes().length);
		TestCase.assertEquals("Incorrect number of objects", 1, taskTwo
				.getObjectTypes().length);
		TestCase.assertEquals("Incorrect object type"Integer.classtaskTwo
		TestCase.assertEquals("Incorrect number of escalations", 1, taskTwo
		TestCase.assertEquals("Incorrect escalation type"IOException.class,
		TestCase.assertEquals("Incorrect return type"String.classtaskTwo
	}

Mock task method.

Parameters:
object Object.
Returns:
Value for parameter.
Throws:
java.io.IOException Escalation.
	public String doTask(Integer objectthrows IOException {
		return "test";
	}
New to GrepCode? Check out our FAQ X