コード例 #1
0
  /** Test que l'inject dependencies renvoit bien l'object envoyé. si celui-ci est déjé advised */
  public void testInjectDependenciesWithAnAdvised() {

    Project basicProject1 = CoreObjectFactory.getProject();

    Project basicProject2 = basicProjectProxyUtil.injectDependencies(basicProject1);

    assertSame(basicProject1, basicProject2);
  }
コード例 #2
0
  /** Test que le getTarget renvoit bien l'objet envoyé quand celui-ci n'est pas un proxy */
  public void testGetTargetWithoutAnAdvised() {

    Project basicProject1 = new ProjectImpl();

    Project basicProject2 = basicProjectProxyUtil.getTarget(basicProject1);

    assertSame(basicProject1, basicProject2);
  }
コード例 #3
0
  /** Test que l'inject dependencies renvoit bien un proxy quand on lui passe un object */
  public void testInjectDependenciesWithoutAnAdvised() {

    Project basicProject = new ProjectImpl();

    Project basicProjectProxyReturned = basicProjectProxyUtil.injectDependencies(basicProject);

    assertTrue(basicProjectProxyReturned instanceof Advised);
  }
コード例 #4
0
  /** Test que le getTarget renvoit bien la target du proxy quand on envoit un proxy */
  public void testGetTargetWithAnAdvised() {

    Project basicProject = CoreObjectFactory.getProject();

    Project basicProjectTargetReturned = basicProjectProxyUtil.getTarget(basicProject);

    // Project est un proxy, il faut r�cup�rer la target
    TargetSource targetSource = ((Advised) basicProject).getTargetSource();
    Object target = ((SingletonTargetSource) targetSource).getTarget();

    assertEquals(basicProjectTargetReturned, target);
  }