Class ModuleTestCase


  • public abstract class ModuleTestCase
    extends ESTestCase
    Base testcase for testing Module implementations.
    • Constructor Detail

      • ModuleTestCase

        public ModuleTestCase()
    • Method Detail

      • assertBinding

        public void assertBinding​(Module module,
                                  java.lang.Class to,
                                  java.lang.Class clazz)
        Configures the module and asserts "clazz" is bound to "to".
      • assertNotBound

        public void assertNotBound​(Module module,
                                   java.lang.Class clazz)
        Configures the module and asserts "clazz" is not bound to anything.
      • assertBindingFailure

        public void assertBindingFailure​(Module module,
                                         java.lang.String... msgs)
        Attempts to configure the module, and asserts an IllegalArgumentException is caught, containing the given messages
      • assertMapMultiBinding

        public void assertMapMultiBinding​(Module module,
                                          java.lang.Class to,
                                          java.lang.Class theClass)
        Configures the module and checks a Map<String, Class> of the "to" class is bound to "theClass".
      • assertSetMultiBinding

        public void assertSetMultiBinding​(Module module,
                                          java.lang.Class to,
                                          java.lang.Class... classes)
        Configures the module and checks a Set of the "to" class is bound to "classes". There may be more classes bound to "to" than just "classes".
      • assertInstanceBinding

        public <T> void assertInstanceBinding​(Module module,
                                              java.lang.Class<T> to,
                                              java.util.function.Predicate<T> tester)
        Configures the module, and ensures an instance is bound to the "to" class, and the provided tester returns true on the instance.
      • bindAndGetInstance

        public static <T> T bindAndGetInstance​(Module module,
                                               java.lang.Class<T> to)
        Configures the module, and returns an instance bound to the "to" class.
      • assertInstanceBindingWithAnnotation

        public <T> void assertInstanceBindingWithAnnotation​(Module module,
                                                            java.lang.Class<T> to,
                                                            java.util.function.Predicate<T> tester,
                                                            java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
        Like assertInstanceBinding(Module, Class, Predicate), but filters the classes checked by the given annotation.
      • assertMapInstanceBinding

        public <K,V> void assertMapInstanceBinding​(Module module,
                                                   java.lang.Class<K> keyType,
                                                   java.lang.Class<V> valueType,
                                                   java.util.Map<K,V> expected)
                                            throws java.lang.Exception
        Configures the module, and ensures a map exists between the "keyType" and "valueType", and that all of the "expected" values are bound.
        Throws:
        java.lang.Exception