Skip to content

Commit

Permalink
Fixes #53 by adding @ConnectionManager annotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lordofthejars committed Feb 14, 2013
1 parent 732a8d4 commit 6df7ff5
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -10,6 +10,7 @@
import org.junit.Test;

import com.lordofthejars.nosqlunit.annotation.ByContainer;
import com.lordofthejars.nosqlunit.annotation.ConnectionManager;

public class WhenFieldIsInjected {

Expand Down Expand Up @@ -83,6 +84,18 @@ public void by_container_object_should_Not_be_injected() {

}

@Test
public void object_should_be_injected_as_field_instance_with_connection_manager() {

InjectAnnotationProcessor injectAnnotationProcessor = new InjectAnnotationProcessor("1");
TestWithFieldConnectionManager testInstance = new TestWithFieldConnectionManager();

injectAnnotationProcessor.processInjectAnnotation(TestWithFieldConnectionManager.class, testInstance, "Hello");

assertThat(testInstance.getMyInjection(), is("Hello"));

}

}

class TestWithInjectionByContainer {
Expand Down Expand Up @@ -117,6 +130,17 @@ public String getMyInjection() {

}

class TestWithFieldConnectionManager {

@ConnectionManager
private String myInjection;

public String getMyInjection() {
return myInjection;
}

}

class TestWithFieldInjection {

@Inject
Expand Down

0 comments on commit 6df7ff5

Please sign in to comment.