Skip to content

Commit 91f527c

Browse files
Copilotchrjohn
andauthored
Harden SocksProxyTest log naming
Agent-Logs-Url: https://github.com/quickfix-j/quickfixj/sessions/a0c02358-15f1-4e45-aa85-eef2df0d3d7b Co-authored-by: chrjohn <6644028+chrjohn@users.noreply.github.com>
1 parent a6a27d7 commit 91f527c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

quickfixj-core/src/test/java/quickfix/mina/SocksProxyTest.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class SocksProxyTest {
4444

4545
@Before
4646
public void setUp() {
47-
LOGGER.info("Starting test {}.{}", getClass().getSimpleName(), testName.getMethodName());
47+
LOGGER.info("Starting test {}", getCurrentTestName());
4848
int proxyPort = AvailablePortFinder.getNextAvailable();
4949

5050
proxyServer = new SocksProxyServer(proxyPort);
@@ -57,7 +57,7 @@ public void tearDown() {
5757
proxyServer.stop();
5858
}
5959

60-
LOGGER.info("Finished test {}.{}", getClass().getSimpleName(), testName.getMethodName());
60+
LOGGER.info("Finished test {}", getCurrentTestName());
6161
}
6262

6363
@Test
@@ -125,6 +125,16 @@ private boolean isLoggedOn(SessionConnector connector, SessionID sessionID) {
125125
return session.isLoggedOn();
126126
}
127127

128+
private String getCurrentTestName() {
129+
String methodName = testName.getMethodName();
130+
131+
if (methodName == null) {
132+
return getClass().getSimpleName();
133+
}
134+
135+
return getClass().getSimpleName() + "." + methodName;
136+
}
137+
128138
private SessionConnector createAcceptor(int port) throws ConfigError {
129139
MessageStoreFactory messageStoreFactory = new MemoryStoreFactory();
130140
MessageFactory messageFactory = new DefaultMessageFactory();

0 commit comments

Comments
 (0)