package com.ankurm.streams; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; import org.springframework.kafka.config.StreamsBuilderFactoryBean; import static org.junit.jupiter.api.Assertions.*; /** Proves the Spring wiring: the factory bean exists and holds a topology, without a broker. */ @SpringBootTest class ContextLoadsTest { @Autowired ApplicationContext ctx; @Test void streamsFactoryBeanIsWiredAndNotStarted() throws Exception { var t = new Transcript("06-spring-context.txt"); var fb = ctx.getBean(StreamsBuilderFactoryBean.class); t.line("StreamsBuilderFactoryBean present: " + (fb != null)); t.line("auto-startup: " + fb.isAutoStartup()); t.line("running: " + fb.isRunning()); t.write(); assertFalse(fb.isRunning()); } }