@Test public void throwsIfCommandNameIsNotRecognized() { Command command = new Command(null, "garbage-command-name"); try { codec.encode(command); fail(); } catch (UnsupportedCommandException expected) { assertThat(expected.getMessage(), startsWith(command.getName() + "\n")); } }
@Test public void throwsIfEncodedCommandHasNoMapping() throws URISyntaxException { HttpRequest request = new HttpRequest(GET, "/foo/bar/baz"); try { codec.decode(request); fail(); } catch (UnsupportedCommandException expected) { assertThat(expected.getMessage(), startsWith("GET /foo/bar/baz\n")); } }