Skip to content

Commit

Permalink
Merge pull request #69 from sashirestela/67-multipart-convert-collect…
Browse files Browse the repository at this point in the history
…ions-to-bytearray

Fixing race conditions on unit tests
  • Loading branch information
sashirestela authored Apr 7, 2024
2 parents 39e2db8 + 13f0039 commit 2317654
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import io.github.sashirestela.cleverclient.support.Configurator;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
Expand All @@ -30,6 +31,7 @@
import static org.mockito.Mockito.when;

@SuppressWarnings("unchecked")
@Order(2)
class HttpProcessorTest {

HttpProcessor httpProcessor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import io.github.sashirestela.cleverclient.support.CleverClientSSE.LineRecord;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;

@Order(1)
class CleverClientSSETest {

Set<String> events = Set.of("process", "process2");
Expand Down Expand Up @@ -36,7 +38,8 @@ void shouldReturnExpectedValueWhenRawDataMeetsConditions() {
var event = (CleverClientSSE) data[0];
var actualCondition = event.isActualData();
var expectedCondition = (boolean) data[1];
assertEquals(expectedCondition, actualCondition);
assertEquals(expectedCondition, actualCondition, "For data '" + event.getActualData()
+ "' was expecting " + expectedCondition + " but was " + actualCondition);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/test/resources/junit-platform.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# ClassOrderer$OrderAnnotation sorts classes based on their @Order annotation
junit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer$OrderAnnotation

0 comments on commit 2317654

Please sign in to comment.