@Test public void acceptsNullResourceVersion() { // Given acceptVersion = AcceptAPIVersion.newBuilder().withDefaultProtocolVersion("1.0").build(); AcceptAPIVersionContext context = new AcceptAPIVersionContext(new RootContext(), "name", acceptVersion); // Then assertNull(context.getResourceVersion()); }
@Test public void handlesValidVersions() { // Given RootContext root = new RootContext(); AcceptAPIVersionContext context = new AcceptAPIVersionContext(root, "name", acceptVersion); // Then assertNotNull(context.getProtocolVersion()); assertNotNull(context.getResourceVersion()); assertEquals(1, context.getProtocolVersion().getMajor()); assertEquals(0, context.getProtocolVersion().getMinor()); assertEquals(2, context.getResourceVersion().getMajor()); assertEquals(1, context.getResourceVersion().getMinor()); }