Correct documented path for locked synchronizer's identity hashcode

Closes gh-15847
pull/15889/head
Andy Wilkinson 6 years ago
parent ebcc53a9b7
commit 59c66eaf41

@ -1,5 +1,5 @@
/*
* Copyright 2012-2018 the original author or authors.
* Copyright 2012-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,6 +16,9 @@
package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
import org.junit.Test;
import org.springframework.boot.actuate.management.ThreadDumpEndpoint;
@ -42,6 +45,22 @@ public class ThreadDumpEndpointDocumentationTests
@Test
public void threadDump() throws Exception {
ReentrantLock lock = new ReentrantLock();
CountDownLatch latch = new CountDownLatch(1);
new Thread(() -> {
try {
lock.lock();
try {
latch.await();
}
finally {
lock.unlock();
}
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}).start();
this.mockMvc.perform(get("/actuator/threaddump")).andExpect(status().isOk())
.andDo(MockMvcRestDocumentation.document("threaddump",
preprocessResponse(limit("threads")),
@ -111,7 +130,7 @@ public class ThreadDumpEndpointDocumentationTests
+ "synchronizer.")
.optional().type(JsonFieldType.STRING),
fieldWithPath(
"threads.[].lockedSynchronizers.[].identifyHashCode")
"threads.[].lockedSynchronizers.[].identityHashCode")
.description(
"Identity hash code of the locked "
+ "synchronizer.")
@ -187,6 +206,7 @@ public class ThreadDumpEndpointDocumentationTests
"Time in milliseconds that the thread has spent "
+ "waiting. -1 if thread contention "
+ "monitoring is disabled"))));
latch.countDown();
}
@Configuration

Loading…
Cancel
Save