I am using DS components with type safe configs like below.

My innermost tests should run outside of OSGi. So I am using Mockito

to inject dependencies into my component.


For configs I use

@Mock

MessagingEndpoint;


In the test I then define behaviour like:

when(config.endpoint()).thenReturn("http://localhost:8082";);

This works but you do not get the default values. So you have to set all
config attributes.


Is there a better way to simulate such configs?


Christian


-----

@ObjectClassDefinition(name = "My config")

public @interface MessagingEndpoint {


    @AttributeDefinition

    String endpoint() default "http://localhost:8176";;


    @AttributeDefinition

    int connectTimeout() default 5000;
}

-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to