TegralSubjectTest

constructor(subjectClass: KClass<TSubject>, baseModuleBuilder: ContextBuilderDsl.() -> Unit)

This constructor takes a module builder and the subject's class, builds the module then uses that as a base.

This is equivalent to calling tegralDiModule on the builder and running the primary constructor instead.

For example:

class TestService : TegralDiBaseTest<Service>(
Service::class, { put(::Service) }
) {
// ...
}

Parameters

subjectClass

The class of the subject, used for subject to work properly.

baseModuleBuilder

The base module as a builder, just like the body of a tegralDiModule call.


constructor(constructor: KFunction<TSubject>)

Shortcut for cases where you want to create a single-component module. For example, this:

class TestService : TegralDiBaseTest<Service>(::Service)

Is equivalent to this:

class TestService : TegralDiBaseTest<Service>(Service::class, { put(::Service) })

constructor(subjectClass: KClass<TSubject>, baseModule: InjectableModule)

This constructor takes a pre-built base module and the class of the subject and uses them as a base.

Parameters

subjectClass

The class of the subject, used for subject to work properly.

baseModule

The base module as an InjectableModule instance.