### Question:
Part1CreationTransformationTermination { @Complexity(MEDIUM) public static void iterateNTimes(int times, AtomicInteger counter) { for (int i = 0; i < times; i++) { counter.incrementAndGet(); } }  @Complexity(EASY) static Observable<String> justABC(); @Complexity(EASY) static Observable<String> fromArray(String... args); @Complexity(EASY) static Observable<String> error(Throwable t); @Complexity(EASY) static Observable<Integer> convertNullableValueToObservable(@Nullable Integer nullableElement); @Complexity(EASY) static Observable<String> deferCalculation(Func0<Observable<String>> calculation); @Complexity(EASY) static Observable<Long> interval(long interval, TimeUnit timeUnit); @Complexity(EASY) static Observable<String> mapToString(Observable<Long> input); @Complexity(EASY) static Observable<String> findAllWordsWithPrefixABC(Observable<String> input); @Complexity(MEDIUM) static Observable<String> fromFutureInIOScheduler(Future<String> future); @Complexity(MEDIUM) static void iterateNTimes(int times, AtomicInteger counter); @Complexity(MEDIUM) static Observable<Character> flatMapWordsToCharacters(Observable<String> input);  }### Answer:
@Test public void iterate10TimesTest() throws Exception { ArgumentCaptor<Integer> captor = ArgumentCaptor.forClass(Integer.class); PowerMockito.spy(Observable.class); PowerMockito .doAnswer(InvocationOnMock::callRealMethod) .when(Observable.class, "range", anyInt(), captor.capture()); AtomicInteger counter = new AtomicInteger(); iterateNTimes(10, counter); Assert.assertEquals("Atomic counter must be increased to 10", 10, counter.get()); Assert.assertEquals("Observable#range(int, int) should be called", 1, captor.getAllValues().size()); }