### Question:
ConverterUtils { public String parseOutput(String right) { return parseOutput(null, right); } ConverterUtils(Spec spec); String parseOutput(String right); String parseOutput(String left, String right); String getGetter(String text);  }### Answer:
@Test public void testGetOutputFieldTypeString() { Spec spec = buildSpec(); spec.setOutput("string"); ConverterUtils converter = new ConverterUtils(spec); assertEquals("output.setString(\"F\");", converter.parseOutput("F")); assertEquals("output.setString(String.format(\"Full name: %s %s\", user.getFirstName(), user.getLastName()));", converter.parseOutput("Full name: $user.firstName $user.lastName")); }
@Test public void testGetOutputFieldTypeInteger() { Spec spec = buildSpec(); spec.setOutput("integer"); ConverterUtils converter = new ConverterUtils(spec); assertEquals("output.setInteger(34);", converter.parseOutput("34")); assertEquals("output.setInteger(user.getAge() * 2);", converter.parseOutput("$user.age * 2")); }
@Test public void testGetOutputFieldTypeNumber() { Spec spec = buildSpec(); spec.setOutput("number"); ConverterUtils converter = new ConverterUtils(spec); assertEquals("output.setNumber((math.getNumber() + physics.getNumber() + biology.getNumber()) / 3);", converter.parseOutput("($math + $physics + $biology) / 3")); }
@Test public void testGetOutputDeclaredType() { Spec spec = buildSpec(); spec.setOutput("Results"); ConverterUtils converter = new ConverterUtils(spec); assertEquals("output.setAverage((math.getNumber() + physics.getNumber() + biology.getNumber()) / 3);", converter.parseOutput("average", "($math + $physics + $biology) / 3")); assertEquals("output.setMax(math.getNumber());", converter.parseOutput("max", "$math")); assertEquals("output.setSubject(\"Math\");", converter.parseOutput("subject", "Math")); }