### Question:
InMemoryBuildRegistry implements BuildRegistry { @Override public List<Binary> getAllBinaries() { return new ArrayList<>(binariesByName.values()); } InMemoryBuildRegistry(); @Override void registerBinary(final Binary binary); @Override List<Binary> getAllBinaries();  }### Answer:
@Test public void testGetAllBinaries() { List<Binary> binaries = new ArrayList<>(); for (int i = 0; i < BINARIES_COUNT; i++) { Binary binary = mock(Binary.class); when(binary.getName()).thenReturn(BINARY_NAME + Integer.toString(i)); binaries.add(binary); } binaries.forEach(binary -> buildRegistry.registerBinary(binary)); List<Binary> result = buildRegistry.getAllBinaries(); assertEquals(binaries.size(), result.size()); for (Binary binary : binaries) { assertTrue(result.contains(binary)); } }