Testing Spring Boot Property Configuration in spring-boot-examples
This test suite evaluates the configuration properties handling in a Spring Boot application using NeoProperties. It validates custom property mappings and basic Map operations in a Spring context environment.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
ityouknow/spring-boot-examples
spring-boot-web/src/test/java/com/neo/web/ProPertiesTest.java
package com.neo.web;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import com.neo.util.NeoProperties;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ProPertiesTest {
@Autowired
private NeoProperties neoProperties;
@Test
public void getHello() throws Exception {
System.out.println(neoProperties.getTitle());
Assert.assertEquals(neoProperties.getTitle(), "纯洁的微笑");
Assert.assertEquals(neoProperties.getDescription(), "分享生活和技术");
}
@Test
public void testMap() throws Exception {
Map<String, Long> orderMinTime=new HashMap<String, Long>();
orderMinTime.get("123");
}
}