### Question:
ComposerHostedUploadHandler implements Handler { @Nonnull @Override public Response handle(@Nonnull final Context context) throws Exception { String vendor = getVendorToken(context); String project = getProjectToken(context); String version = getVersionToken(context); Request request = checkNotNull(context.getRequest()); Payload payload = checkNotNull(request.getPayload()); Repository repository = context.getRepository(); ComposerHostedFacet hostedFacet = repository.facet(ComposerHostedFacet.class); hostedFacet.upload(vendor, project, version, payload); return HttpResponses.ok(); }  @Nonnull @Override Response handle(@Nonnull final Context context);  }### Answer:
@Test public void testHandle() throws Exception { when(repository.facet(ComposerHostedFacet.class)).thenReturn(composerHostedFacet); when(request.getPayload()).thenReturn(payload); when(context.getRepository()).thenReturn(repository); when(context.getAttributes()).thenReturn(attributes); when(context.getRequest()).thenReturn(request); when(attributes.require(TokenMatcher.State.class)).thenReturn(state); when(state.getTokens()).thenReturn(tokens); when(tokens.get(VENDOR_TOKEN)).thenReturn("testvendor"); when(tokens.get(PROJECT_TOKEN)).thenReturn("testproject"); when(tokens.get(VERSION_TOKEN)).thenReturn("testversion"); Response response = underTest.handle(context); assertThat(response.getStatus().getCode(), is(200)); assertThat(response.getPayload(), is(nullValue())); verify(composerHostedFacet).upload("testvendor", "testproject", "testversion", payload); }