/// <summary>
		/// Returns a mock java class definition generator.
		/// </summary>
		private static IJavaClassDefinitionGenerator GetMockJavaClassDefinitionGenerator(
			JavaFileBuilder builder,
			JavaClass javaClass)
		{
			var generator = new Mock<IJavaClassDefinitionGenerator>();

			generator
				.Setup
				(
					g => g.GenerateClassDefinition()
				)
				.Callback
				(
					() => builder.AddLine(javaClass.ClassName)
				);

			return generator.Object;
		}
		/// <summary>
		/// Returns a new generated question template based off of an existing question. 
		/// The generated question is not saved unless and until it is submitted through 
		/// CreateQuestionAsync.
		/// </summary>
		public async Task<Question> GenerateFromExistingQuestionAsync(
			string classroomName,
			int existingQuestionId)
		{
			var existingQuestion = await GetQuestionAsync(classroomName, existingQuestionId);

			if (existingQuestion is GeneratedQuestionTemplate)
			{
				throw new InvalidOperationException(
					"Cannot generate question from existing generated question.");
			}

			var builder = new JavaFileBuilder();

			builder.AddLine("public class QuestionGenerator");
			builder.BeginScope("{");
				builder.AddLine("public static Question generateQuestion(int seed)");
				builder.BeginScope("{");
					_questionGenerator.GenerateConstructorInvocation
					(
						existingQuestion,
						builder
					);
				builder.EndScope("}");
			builder.EndScope("}");

			return new GeneratedQuestionTemplate()
			{
				Name = $"{existingQuestion.Name} (generated)",
				QuestionCategoryId = existingQuestion.QuestionCategoryId,
				Description = "Generated Question",
				ImportedClasses = new List<ImportedClass>()
				{
					new ImportedClass()
					{
						ClassName = "java.util.*"
					}
				},
				GeneratorContents = builder.GetFileContents()
			};
		}
		/// <summary>
		/// Returns a mock java constructor invocation generator.
		/// </summary>
		private static IJavaConstructorInvocationGenerator GetMockJavaConstructorInvocationGenerator(
			JavaFileBuilder builder,
			Question question)
		{
			var generator = new Mock<IJavaConstructorInvocationGenerator>();

			generator
				.Setup
				(
					g => g.GenerateConstructorInvocation
					(
						question,
						"return ",
						";"
					)
				)
				.Callback<object, string, string>
				(
					(obj, prefix, suffix) => builder.AddLine("ConstructorInvocation")
				);

			return generator.Object;
		}