### Question:
ComposerProxyFacetImpl extends ProxyFacetSupport { @Override protected Content store(final Context context, final Content content) throws IOException { AssetKind assetKind = context.getAttributes().require(AssetKind.class); switch (assetKind) { case PACKAGES: return content().put(PACKAGES_JSON, generatePackagesJson(context), assetKind); case LIST: return content().put(LIST_JSON, content, assetKind); case PROVIDER: return content().put(buildProviderPath(context), content, assetKind); case ZIPBALL: return content().put(buildZipballPath(context), content, assetKind); default: throw new IllegalStateException(); } } @Inject  ComposerProxyFacetImpl(final ComposerJsonProcessor composerJsonProcessor);   }### Answer:
@Test public void storePackages() throws Exception { when(contextAttributes.require(AssetKind.class)).thenReturn(PACKAGES); when(composerContentFacet.put(PACKAGES_PATH, content, PACKAGES)).thenReturn(content); when(viewFacet.dispatch(any(Request.class), eq(context))).thenReturn(response); when(composerJsonProcessor.generatePackagesFromList(repository, payload)).thenReturn(content); assertThat(underTest.store(context, content), is(content)); verify(composerContentFacet).put(PACKAGES_PATH, content, PACKAGES); }
@Test public void storeList() throws Exception { when(contextAttributes.require(AssetKind.class)).thenReturn(LIST); when(composerContentFacet.put(LIST_PATH, content, LIST)).thenReturn(content); assertThat(underTest.store(context, content), is(content)); verify(composerContentFacet).put(LIST_PATH, content, LIST); }
@Test public void storeProvider() throws Exception { when(contextAttributes.require(AssetKind.class)).thenReturn(PROVIDER); when(contextAttributes.require(TokenMatcher.State.class)).thenReturn(state); when(composerContentFacet.put(PROVIDER_PATH, content, PROVIDER)).thenReturn(content); when(state.getTokens()).thenReturn(new ImmutableMap.Builder<String, String>() .put("vendor", "vendor") .put("project", "project") .build()); assertThat(underTest.store(context, content), is(content)); verify(composerContentFacet).put(PROVIDER_PATH, content, PROVIDER); }
@Test public void storeZipball() throws Exception { when(contextAttributes.require(AssetKind.class)).thenReturn(ZIPBALL); when(contextAttributes.require(TokenMatcher.State.class)).thenReturn(state); when(composerContentFacet.put(ZIPBALL_PATH, content, ZIPBALL)).thenReturn(content); when(state.getTokens()).thenReturn(new ImmutableMap.Builder<String, String>() .put("vendor", "vendor") .put("project", "project") .put("version", "version") .put("name", "project-version") .build()); assertThat(underTest.store(context, content), is(content)); verify(composerContentFacet).put(ZIPBALL_PATH, content, ZIPBALL); }