package cn.learn.actuator.learnspringbootautuator;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class LearnSpringBootAutuatorApplicationTests {

	@Test
	public void contextLoads() {
	}

}

@@ -56,116 +56,495 @@
 ort 
-org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.boot.test.context.SpringBootTest
+static org.assertj.core.api.Assertions.assertThat;%0A%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.test.context.SpringBootTest;%0Aimport org.springframework.boot.test.context.SpringBootTest.WebEnvironment;%0Aimport org.springframework.boot.test.web.client.TestRestTemplate;%0Aimport org.springframework.http.HttpStatus;%0Aimport org.springframework.http.ResponseEntity
 ;%0Aim
@@ -647,16 +647,61 @@
 BootTest
+(webEnvironment = WebEnvironment.RANDOM_PORT)
 %0Apublic 
@@ -788,12 +788,806 @@
 s() %7B%0A%09%7D
+%0A%09%0A%09@Autowired%0A%09private TestRestTemplate restTemplate;%0A%09%0A%09@Test%0A%09public void testHomeIsSecure() throws Exception %7B%0A%09%09ResponseEntity%3CMap%3E entity  = this.restTemplate.getForEntity(%22/%22, Map.class);%0A%09%09assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);%0A%09%09%0A%09%09Map%3CString, Object%3E body = entity.getBody();%0A%09%09assertThat(body.get(%22error%22)).isEqualTo(%22Unauthorized%22);%0A%09%09assertThat(entity.getHeaders()).doesNotContainKey(%22Set-Cookie%22);%0A%09%7D%0A%09%0A%09@Test%0A%09public void testHome() throws Exception %7B%0A%09%09ResponseEntity%3CMap%3E entity  = this.restTemplate.withBasicAuth(%22user%22, %22password%22).getForEntity(%22/%22, Map.class);%0A%09%09assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);%0A%09%09%0A%09%09Map%3CString, Object%3E body = entity.getBody();%0A%09%09assertThat(body.get(%22message%22)).isEqualTo(%22Hello Li, chunhui%22);%0A%09%7D
 %0A%0A%7D%0A

Update LearnSpringBootAutuatorApplicationTests.java