7 Replies Latest reply on Nov 6, 2013 8:25 AM by Kevin Joymungol

    WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject private org.arquillian.example.Greeter.log] error

    Kevin Joymungol Newbie

      I am running a basic arquillian unit test, using the Greeter example on the arquillian site. The only difference is that am doing a log.debug in the greet(PrintStream to, String name) function in Greeter.java. Am using slf4j for logging.

      Greeter.java

       

          package org.arquillian.example;
          import java.io.PrintStream;

          import javax.inject.Inject;

          import org.slf4j.Logger;

          public class Greeter {

          @Inject
          private Logger log;

            public void greet(PrintStream to, String name) {
                log.debug("Greeter Testing");
                to.println(createGreeting(name));
            }

            public String createGreeting(String name) {
                return "Hello, " + name + "!";
           

         }

       

      GreeterTest.java

       

          package org.arquillian.example;

          import javax.inject.Inject;
          import org.jboss.arquillian.container.test.api.Deployment;
          import org.jboss.arquillian.junit.Arquillian;
          import org.jboss.shrinkwrap.api.ShrinkWrap;
          import org.jboss.shrinkwrap.api.asset.EmptyAsset;
          import org.jboss.shrinkwrap.api.spec.JavaArchive;
          import org.junit.Assert;
          import org.junit.Test;
          import org.junit.runner.RunWith;

          @RunWith(Arquillian.class)
          public class GreeterTest {

             @Inject
            Greeter greeter; 

            @Deployment
            public static JavaArchive createDeployment() {
                return ShrinkWrap.create(JavaArchive.class)
                .addClass(Greeter.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
            }

            @Test
            public void should_create_greeting() {
                Assert.assertEquals("Hello, Earthling!",
                greeter.createGreeting("Earthling"));
                greeter.greet(System.out, "Earthling");
         

         }

       

            Am getting WELD-001408 Unsatisfied dependencies for type [Logger] with qualifiers [@Default] at injection point [[field] @Inject private org.arquillian.example.Greeter. Can someone please help on this?