All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkiverse.mailpit.test.QuarkusMailpitManager Maven / Gradle / Ivy

The newest version!
package io.quarkiverse.mailpit.test;

import java.util.Collections;
import java.util.Map;

import io.quarkus.test.common.QuarkusTestResourceConfigurableLifecycleManager;

public class QuarkusMailpitManager implements QuarkusTestResourceConfigurableLifecycleManager {

    private WithMailbox options;
    private Mailbox mailbox;

    @Override
    public void init(WithMailbox annotation) {
        this.options = annotation;
        this.mailbox = new Mailbox();
    }

    @Override
    public void init(Map initArgs) {
        throw new IllegalStateException("Use @WithMailbox() annotation instead");
    }

    @Override
    public Map start() {
        return Collections.emptyMap();
    }

    @Override
    public void stop() {
        // nothing to stop
    }

    @Override
    public void inject(TestInjector testInjector) {
        testInjector.injectIntoFields(mailbox,
                new TestInjector.AnnotatedAndMatchesType(InjectMailbox.class, Mailbox.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy