001/*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved.            *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD      *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file.                                                     *
007 *                                                                           *
008 * Original code by                                                          *
009 *****************************************************************************/
010package org.picocontainer.alternatives;
011
012import static org.junit.Assert.assertNotNull;
013import static org.junit.Assert.assertEquals;
014
015import org.junit.Test;
016import org.picocontainer.injectors.ParameterNameBinding;
017
018import com.thoughtworks.paranamer.DefaultParanamer;
019import com.thoughtworks.paranamer.Paranamer;
020import com.thoughtworks.paranamer.AdaptiveParanamer;
021import com.thoughtworks.paranamer.CachingParanamer;
022
023import java.lang.reflect.Method;
024
025public class ParanamerPicoContainerTestCase {
026
027    @Test
028    public void testCanInstantiateParanamer() {
029        Paranamer paranamer = new DefaultParanamer();
030        assertNotNull(paranamer);
031    }
032
033
034    public void methodToFind(String name) {
035                assert name != null;
036        }
037    
038
039    @Test
040    public void
041           testNameBindingShouldNotThrowWhenAreParameterNamesAreNotAvailable()
042            throws Exception {
043        Paranamer paranamer = new CachingParanamer(new AdaptiveParanamer());
044
045        Method method = getClass().getMethod("methodToFind", String.class);
046        ParameterNameBinding binding = new ParameterNameBinding(paranamer, method, 0);
047
048        assertEquals("name", binding.getName());
049    }
050
051
052}