Search in sources :

Example 1 with Genie

use of org.osgl.inject.Genie in project java-di by osglworks.

the class GH21 method testEquality.

@Test
public void testEquality() {
    Genie genie = Genie.create();
    Field xfoo = $.fieldOf(X.class, "foo");
    Field yfoo = $.fieldOf(Y.class, "foo");
    assertNotEquals(BeanSpec.of(xfoo, genie), BeanSpec.of(yfoo, genie));
}
Also used : Field(java.lang.reflect.Field) Genie(org.osgl.inject.Genie) Test(org.junit.Test)

Example 2 with Genie

use of org.osgl.inject.Genie in project java-di by osglworks.

the class GH25 method test.

@Test
public void test() {
    Genie genie = Genie.create();
    genie.registerNamedProvider(Foo.class, new FooProvider());
    FooHolder fooHolder = genie.get(FooHolder.class);
    eq("bar", fooHolder.foo.name);
}
Also used : Genie(org.osgl.inject.Genie) Test(org.junit.Test)

Example 3 with Genie

use of org.osgl.inject.Genie in project java-di by osglworks.

the class Gh20 method test.

@Test
public void test() {
    Genie genie = Genie.create();
    BeanSpec spec = BeanSpec.of(int[].class, genie);
    eq(int.class, spec.componentSpec().rawType());
}
Also used : Genie(org.osgl.inject.Genie) BeanSpec(org.osgl.inject.BeanSpec) Test(org.junit.Test)

Example 4 with Genie

use of org.osgl.inject.Genie in project java-di by osglworks.

the class Gh19 method test.

@Test
public void test() {
    Genie genie = Genie.create();
    BeanSpec spec = BeanSpec.of(IntA.class, genie);
    yes(spec.isInterface());
    spec = BeanSpec.of(Gh19.class, genie);
    no(spec.isInterface());
}
Also used : Genie(org.osgl.inject.Genie) BeanSpec(org.osgl.inject.BeanSpec) Test(org.junit.Test)

Example 5 with Genie

use of org.osgl.inject.Genie in project java-di by osglworks.

the class GH10 method test.

@Test
public void test() {
    Genie genie = Genie.create(Binder.class);
    A a = genie.get(A.class);
    eq("foo", a.a());
}
Also used : Genie(org.osgl.inject.Genie) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 Genie (org.osgl.inject.Genie)7 BeanSpec (org.osgl.inject.BeanSpec)4 Field (java.lang.reflect.Field)1 Ignore (org.junit.Ignore)1