### Question:
BuildServiceImpl implements BuildService { @Override public BuildResults build(final Module module) { return buildServiceHelper.localBuild(module); } BuildServiceImpl(); @Inject  BuildServiceImpl(final KieModuleService moduleService,
                            final BuildServiceHelper buildServiceHelper,
                            final LRUBuilderCache cache); @Override BuildResults build(final Module module); void build(final Module module,
                      final Consumer<Builder> consumer); @Override BuildResults buildAndDeploy(final Module module); @Override BuildResults buildAndDeploy(final Module module,
                                       final DeploymentMode mode); @Override BuildResults buildAndDeploy(final Module module,
                                       final boolean suppressHandlers); @Override BuildResults buildAndDeploy(final Module module,
                                       final boolean suppressHandlers,
                                       final DeploymentMode mode); @Override boolean isBuilt(final Module module); @Override IncrementalBuildResults addPackageResource(final Path resource); @Override IncrementalBuildResults deletePackageResource(final Path resource); @Override IncrementalBuildResults updatePackageResource(final Path resource); @Override IncrementalBuildResults applyBatchResourceChanges(final Module module,
                                                             final Map<Path, Collection<ResourceChange>> changes);  }### Answer:
@Test public void testBuild() { when(buildServiceHelper.localBuild(module)).thenReturn(buildResults); BuildResults result = buildService.build(module); assertEquals(buildResults, result); }
@Test public void testBuildWithConsumer() { when(localBinaryConfig.getBuilder()).thenReturn(builder); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { Consumer consumer = (Consumer) invocation.getArguments()[1]; consumer.accept(localBinaryConfig); return null; } }).when(buildServiceHelper).localBuild(eq(module), any(Consumer.class)); buildService.build(module, new Consumer<Builder>() { @Override public void accept(Builder result) { assertEquals(builder, result); } }); verify(buildServiceHelper, times(1)).localBuild(eq(module), any(Consumer.class)); }