### Question:
NativeCommandListener extends CommandListenerAdapter { @Override public void onError(String message) { if (promise != null) promise.reject(new Throwable(message)); } NativeCommandListener(String commandId, @Nullable Promise promise, EventEmitter eventEmitter, Now now); @Override void onSuccess(String childId); @Override void onError(String message);  }### Answer:
@Test public void onError() { uut.onError("something which is wrong"); ArgumentCaptor<Throwable> captor = ArgumentCaptor.forClass(Throwable.class); verify(promise, times(1)).reject(captor.capture()); assertThat(captor.getValue().getMessage().equals("something which is wrong")); }