### Question:
PipesBuilder implements Builder<Pipes> { public PipesBuilder withWriter(final String writer) { this.writer.set(writer); return this; } PipesBuilder(); PipesBuilder withMap(final String map); PipesBuilder withReduce(final String reduce); PipesBuilder withInputformat(final String inputformat); PipesBuilder withPartitioner(final String partitioner); PipesBuilder withWriter(final String writer); PipesBuilder withProgram(final String program); @Override Pipes build();  }### Answer:
@Test public void testWithWriter() { final String writer = "writer"; final PipesBuilder builder = new PipesBuilder(); builder.withWriter(writer); final Pipes pipes = builder.build(); assertEquals(writer, pipes.getWriter()); }
@Test public void testWithWriterCalledTwiceThrows() { final String writer1 = "writer1"; final String writer2 = "writer2"; final PipesBuilder builder = new PipesBuilder(); builder.withWriter(writer1); expectedException.expect(IllegalStateException.class); builder.withWriter(writer2); }