### Question:
ComposerPathUtils { public static String buildZipballPath(final Context context) { TokenMatcher.State state = context.getAttributes().require(TokenMatcher.State.class); Map<String, String> tokens = state.getTokens(); return buildZipballPath( tokens.get(VENDOR_TOKEN), tokens.get(PROJECT_TOKEN), tokens.get(VERSION_TOKEN), tokens.get(NAME_TOKEN)); } private  ComposerPathUtils(); static String getVendorToken(final Context context); static String getProjectToken(final Context context); static String getVersionToken(final Context context); static String buildZipballPath(final Context context); static String buildZipballPath(final String vendor, final String project, final String version); static String buildProviderPath(final Context context); static String buildProviderPath(final String vendor, final String project);  }### Answer:
@Test public void buildZipballPathFromContextWithNameToken() { when(context.getAttributes()).thenReturn(contextAttributes); when(contextAttributes.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("1.2.3"); when(tokens.get(NAME_TOKEN)).thenReturn("name"); assertThat(ComposerPathUtils.buildZipballPath(context), is("testvendor/testproject/1.2.3/name.zip")); }
@Test public void buildZipballPathFromContextWithoutNameToken() { when(context.getAttributes()).thenReturn(contextAttributes); when(contextAttributes.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("1.2.3"); assertThat(ComposerPathUtils.buildZipballPath(context), is("testvendor/testproject/1.2.3/testvendor-testproject-1.2.3.zip")); }
@Test public void buildZipballPathFromValues() { when(context.getAttributes()).thenReturn(contextAttributes); when(contextAttributes.require(TokenMatcher.State.class)).thenReturn(state); when(state.getTokens()).thenReturn(tokens); assertThat(ComposerPathUtils.buildZipballPath("testvendor", "testproject", "1.2.3"), is("testvendor/testproject/1.2.3/testvendor-testproject-1.2.3.zip")); }