### Question:
ExperimentingRunnerModule extends AbstractModule { @Provides ImmutableSet<Instrumentation> provideInstrumentations(CaliperOptions options, BenchmarkClass benchmarkClass, ImmutableSet<Instrument> instruments) throws InvalidBenchmarkException { ImmutableSet.Builder<Instrumentation> builder = ImmutableSet.builder(); ImmutableSet<String> benchmarkMethodNames = options.benchmarkMethodNames(); for (Instrument instrument : instruments) { for (Method method : findAllBenchmarkMethods(benchmarkClass.benchmarkClass(), instrument)) { if (benchmarkMethodNames.isEmpty() || benchmarkMethodNames.contains(method.getName())) { builder.add(instrument.createInstrumentation(method)); } } } return builder.build(); }    }### Answer:
@Test public void provideInstrumentations_noNames() throws Exception { when(options.benchmarkMethodNames()).thenReturn(ImmutableSet.<String>of()); assertEquals( new ImmutableSet.Builder<Instrumentation>() .add(instrumentA.createInstrumentation(methodA)) .add(instrumentA.createInstrumentation(methodB)) .add(instrumentA.createInstrumentation(methodC)) .add(instrumentB.createInstrumentation(methodA)) .add(instrumentB.createInstrumentation(methodB)) .add(instrumentB.createInstrumentation(methodC)) .build(), module.provideInstrumentations(options, BenchmarkClass.forClass(TestBenchmark.class), ImmutableSet.of(instrumentA, instrumentB))); }
@SuppressWarnings("unchecked") @Test public void provideInstrumentations_withNames() throws Exception { when(options.benchmarkMethodNames()).thenReturn(ImmutableSet.of("b"), ImmutableSet.of("a", "c")); assertEquals( new ImmutableSet.Builder<Instrumentation>() .add(instrumentA.createInstrumentation(methodB)) .add(instrumentB.createInstrumentation(methodB)) .build(), module.provideInstrumentations(options, BenchmarkClass.forClass(TestBenchmark.class), ImmutableSet.of(instrumentA, instrumentB))); assertEquals( new ImmutableSet.Builder<Instrumentation>() .add(instrumentA.createInstrumentation(methodA)) .add(instrumentA.createInstrumentation(methodC)) .add(instrumentB.createInstrumentation(methodA)) .add(instrumentB.createInstrumentation(methodC)) .build(), module.provideInstrumentations(options, BenchmarkClass.forClass(TestBenchmark.class), ImmutableSet.of(instrumentA, instrumentB))); }