### Question:
TimeValueFormatter { public String toRaw(final String input) { if (!input.contains(" ")) { return appendPrefixAndSuffix(input); } final String[] parts = input.split(" "); if (parts.length == 2) { final String secondPart = parts[1].trim(); if (timeZoneProvider.isTimeZone(secondPart)) { return appendPrefixAndSuffix(parts[0].trim() + "@" + secondPart); } else { return appendPrefixAndSuffix(parts[0].trim() + "Z"); } } final String time = parts[0].trim(); final String offSet = parts[2].trim(); return appendPrefixAndSuffix(time + offSet); } @Inject  TimeValueFormatter(final TimeZoneProvider timeZoneProvider); String toDisplay(final String input); String buildRawValue(final String time,
                                final String selectedTimeZone); TimeValue getTimeValue(final String val); String toRaw(final String input); String getTime(final String raw); String appendPrefixAndSuffix(final String input);  }### Answer:
@Test public void testToRawSimpleTime() { final String expected = "time(\"22:30:10\")"; final String input = "22:30:10"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }
@Test public void testToRawTimeWithNegativeTimeOffSet() { final String expected = "time(\"22:30:10-03:00\")"; final String input = "22:30:10 UTC -03:00"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }
@Test public void testToRawTimeWithPositiveTimeOffSet() { final String expected = "time(\"22:30:10+03:00\")"; final String input = "22:30:10 UTC +03:00"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }
@Test public void testToRawTimeWithUTCTimeZone() { when(provider.isTimeZone("UTC")).thenReturn(false); final String expected = "time(\"22:30:10Z\")"; final String input = "22:30:10 UTC"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }
@Test public void testToRawTimeWithTimeZone() { when(provider.isTimeZone("America/Sao_Paulo")).thenReturn(true); final String expected = "time(\"22:30:10@America/Sao_Paulo\")"; final String input = "22:30:10 America/Sao_Paulo"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }
@Test public void testToRawTimeWithTimeZoneWithDash() { when(provider.isTimeZone(any())).thenReturn(true); final String expected = "time(\"22:30:10@US/Pacific-New\")"; final String input = "22:30:10 US/Pacific-New"; final String actual = formatter.toRaw(input); assertEquals(expected, actual); }