Skip to content

Commit 603296b

Browse files
Found root cause of test failure, I'd added @OnWebsocketError handling in the Communicator. I've commented this out and since I also had updated the error message to be more descriptive then I've also added assertJ dependencies and have updated the test to check the error message _contains_ the expected message instead.
1 parent 658828d commit 603296b

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

pom.xml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,28 +187,19 @@
187187
</distributionManagement>
188188

189189
<dependencies>
190+
<!-- Bot dependencies -->
190191
<dependency>
191192
<groupId>org.eclipse.jetty.websocket</groupId>
192193
<artifactId>websocket-client</artifactId>
193194
<version>9.4.8.v20171121</version>
194195
</dependency>
195-
<dependency>
196-
<groupId>org.junit.jupiter</groupId>
197-
<artifactId>junit-jupiter-api</artifactId>
198-
<version>${junit.version}</version>
199-
<scope>test</scope>
200-
</dependency>
201-
<dependency>
202-
<groupId>org.junit.jupiter</groupId>
203-
<artifactId>junit-jupiter-engine</artifactId>
204-
<version>${junit.version}</version>
205-
<scope>test</scope>
206-
</dependency>
207196
<dependency>
208197
<groupId>com.google.code.gson</groupId>
209198
<artifactId>gson</artifactId>
210199
<version>2.8.2</version>
211200
</dependency>
201+
202+
<!-- Logging dependencies -->
212203
<dependency>
213204
<groupId>org.slf4j</groupId>
214205
<artifactId>slf4j-api</artifactId>
@@ -219,6 +210,27 @@
219210
<artifactId>slf4j-simple</artifactId>
220211
<version>${slf4j.version}</version>
221212
</dependency>
213+
214+
<!-- Test dependencies -->
215+
<dependency>
216+
<groupId>org.junit.jupiter</groupId>
217+
<artifactId>junit-jupiter-api</artifactId>
218+
<version>${junit.version}</version>
219+
<scope>test</scope>
220+
</dependency>
221+
<dependency>
222+
<groupId>org.junit.jupiter</groupId>
223+
<artifactId>junit-jupiter-engine</artifactId>
224+
<version>${junit.version}</version>
225+
<scope>test</scope>
226+
</dependency>
227+
<dependency>
228+
<groupId>org.assertj</groupId>
229+
<artifactId>assertj-core</artifactId>
230+
<version>3.18.1</version>
231+
<scope>test</scope>
232+
</dependency>
233+
222234
</dependencies>
223235

224236
</project>

src/main/java/net/twasi/obsremotejava/OBSCommunicator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void await() throws InterruptedException {
149149
@OnWebSocketError
150150
public void onError(Session session, Throwable throwable) {
151151
// do nothing for now, this should at least repress "OnWebsocketError not registered" messages
152-
runOnError("Websocket error occurred with session " + session, throwable);
152+
//runOnError("Websocket error occurred with session " + session, throwable);
153153
}
154154

155155
@OnWebSocketClose

src/test/java/net/twasi/obsremotejava/test/OBSRemoteControllerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import java.util.concurrent.atomic.AtomicReference;
1414

15+
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
1516
import static org.junit.jupiter.api.Assertions.*;
1617

1718
public class OBSRemoteControllerTest {
@@ -66,7 +67,7 @@ void testConnectionToWrongPortAndExpectConnectionFailedError() {
6667
fail(testFailedReason.get());
6768
}
6869

69-
assertEquals("Failed to connect to OBS", connectionFailedResult.get());
70+
assertThat(connectionFailedResult.get()).contains("Failed to connect to OBS");
7071
assertTrue(controller.isFailed());
7172
}
7273
}

0 commit comments

Comments
 (0)