### Question:
BuildInfoService { public BuildInfo getBuildInfo(final Module module) { final Builder[] result = {builderCache.getBuilder(module)}; if (result[0] == null || !result[0].isBuilt()) { ((BuildServiceImpl) buildService).build(module, builder -> result[0] = builder); } return new BuildInfoImpl(result[0]); } BuildInfoService(); @Inject  BuildInfoService(BuildService buildService,
                            LRUBuilderCache builderCache); BuildInfo getBuildInfo(final Module module);  }### Answer:
@Test public void testGetBuildInfoWhenModuleIsBuilt() { when(cache.getBuilder(module)).thenReturn(builder); when(builder.isBuilt()).thenReturn(true); BuildInfo expectedBuildInfo = new BuildInfoImpl(builder); BuildInfo result = buildInfoService.getBuildInfo(module); assertEquals(expectedBuildInfo, result); verify(cache, times(1)).getBuilder(module); verify(buildService, never()).build(eq(module), any(Consumer.class)); }