### Question:
RepresentationBuilder { Collection<Representation> build(MethodContext ctx) { final Collection<Representation> representations = new ArrayList<Representation>(); final Method javaMethod = ctx.getJavaMethod(); final GrammarsDiscoverer grammarsDiscoverer = ctx.getParentContext().getGrammarsDiscoverer(); for (MediaType mediaType : ctx.getMediaTypes()) { final Class<?> returnType = javaMethod.getReturnType(); if (isVoid(returnType)) { continue; } final QName qName = grammarsDiscoverer.discoverQNameFor(new ClassMetadataFromReturnType(javaMethod)); representations.add(new Representation().withMediaType(mediaType.toString()).withElement(qName)); } return representations; }    }### Answer:
@Test public void givenVoidAsMethodReturnType_whenBuildRepresentation_thenDoNotAddAnything() throws NoSuchMethodException { final ApplicationContext appCtx = new ApplicationContext(IGNORED_METHOD_CONTEXT_ITERATOR, new GrammarsDiscoverer(new ClassTypeDiscoverer(new QNameBuilderFactory().getBuilder()))); final MethodContext methodCtxMock = mock(MethodContext.class); doReturn(appCtx).when(methodCtxMock).getParentContext(); doReturn(new HashSet<MediaType>() {{ add(MediaType.APPLICATION_JSON); }}).when(methodCtxMock).getMediaTypes(); doReturn(JavaMethod.WITHOUT_PARAMETERS).when(methodCtxMock).getJavaMethod(); final Collection<Representation> representations = representationBuilder.build(methodCtxMock); assertThat(representations, Matchers.is(Matchers.empty())); }