Skip to content

Instantly share code, notes, and snippets.

View Dainerx's full-sized avatar
💨

Oussama Ben Ghorbel (Dainerx) Dainerx

💨
View GitHub Profile
@Dainerx
Dainerx / SelectServiceBeanTest.java
Last active November 21, 2021 16:47 — forked from Toparvion/HOWTO.md
JUnit test for conditional Spring Boot bean registration (@ConditionalOnProperty)
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;