All pastes #543788 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-06 05:33 UTC
rendered paste body
  /**
   * Verifies that the action referred to by an ActionInvocation is injected
   * into an annotated method on the action implementation.
   * 
   * @throws Exception
   *           if the injection fails or the invocation throws an exception.
   */
  @Test
  public void injectsDummyServiceToAnnotated () throws Exception {
    PodcastServiceInjector injector = new PodcastServiceInjector ();

    final InjectionTarget target = new InjectionTarget ();
    final ActionInvocation invocation = context.mock (ActionInvocation.class);

    context.checking (new Expectations () {
      {
        one (invocation).getAction ();
        will (returnValue (target));

        one (invocation).getResult ();
        will (returnValue (context.mock (Result.class)));
      }
    });

    injector.intercept (invocation);

    assertTrue (target.getSource () instanceof DummyPodcastFactory);
  }