Skip to content

Commit b27c1bd

Browse files
authored
🐛 fix for no tests found (#226)
1 parent 4c5e62e commit b27c1bd

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/main/java/com/mindee/CommandLineInterface.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ public Integer call() throws Exception {
138138
}
139139
}
140140

141-
142-
143141
@Command(name = "custom", description = "Invokes a Custom API (API Builder only, use 'generated' for regular custom APIs)")
144142
void customMethod(
145143
@Option(

src/test/java/com/mindee/http/MindeeHttpApiTest.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.nio.file.Paths;
2525
import java.util.List;
2626
import java.util.Map;
27-
import junit.framework.TestCase;
2827
import okhttp3.mockwebserver.MockResponse;
2928
import okhttp3.mockwebserver.MockWebServer;
3029
import okhttp3.mockwebserver.RecordedRequest;
@@ -33,21 +32,24 @@
3332
import org.apache.http.impl.client.HttpClients;
3433
import org.apache.http.impl.conn.DefaultProxyRoutePlanner;
3534
import org.hamcrest.collection.IsMapContaining;
35+
import org.junit.After;
3636
import org.junit.Assert;
37+
import org.junit.Before;
3738
import org.junit.jupiter.api.Assertions;
3839
import org.junit.jupiter.api.Test;
3940

40-
public class MindeeHttpApiTest extends TestCase {
41+
public class MindeeHttpApiTest {
4142

4243
MockWebServer mockWebServer = new MockWebServer();
4344
private static ObjectMapper objectMapper = new ObjectMapper();
4445

45-
public void setUp() throws Exception {
46-
super.setUp();
46+
@Before
47+
public void startWebServer() throws Exception {
4748
mockWebServer.start();
4849
}
4950

50-
public void tearDown() throws Exception {
51+
@After
52+
public void stopWebServer() throws Exception {
5153
mockWebServer.shutdown();
5254
}
5355

@@ -360,9 +362,9 @@ void givenError401_noToken_mustThrowMindeeHttpException()
360362
new Endpoint(InvoiceV4.class),
361363
parseParameter)
362364
);
363-
assertEquals(401, httpError.getStatusCode());
364-
assertEquals("Authorization required", httpError.getMessage());
365-
assertEquals("No token provided", httpError.getDetails());
365+
Assertions.assertEquals(401, httpError.getStatusCode());
366+
Assertions.assertEquals("Authorization required", httpError.getMessage());
367+
Assertions.assertEquals("No token provided", httpError.getDetails());
366368
}
367369

368370
@Test
@@ -386,10 +388,10 @@ void givenError429_mustThrowMindeeHttpException()
386388
new Endpoint(InvoiceV4.class),
387389
parseParameter)
388390
);
389-
assertEquals(429, httpError.getStatusCode());
390-
assertEquals("Too many requests", httpError.getMessage());
391-
assertEquals("Too Many Requests.", httpError.getDetails());
392-
assertEquals("TooManyRequests", httpError.getCode());
391+
Assertions.assertEquals(429, httpError.getStatusCode());
392+
Assertions.assertEquals("Too many requests", httpError.getMessage());
393+
Assertions.assertEquals("Too Many Requests.", httpError.getDetails());
394+
Assertions.assertEquals("TooManyRequests", httpError.getCode());
393395
}
394396

395397
@Test
@@ -413,10 +415,10 @@ void givenError_inHtml_mustThrowMindeeHttpException()
413415
new Endpoint(InvoiceV4.class),
414416
parseParameter)
415417
);
416-
assertEquals(413, httpError.getStatusCode());
417-
assertEquals("HTTP Status 413 - Unhandled server response, check details.", httpError.getMessage());
418-
assertTrue(httpError.getDetails().contains("<h1>An error occurred.</h1>"));
419-
assertEquals("", httpError.getCode());
418+
Assertions.assertEquals(413, httpError.getStatusCode());
419+
Assertions.assertEquals("HTTP Status 413 - Unhandled server response, check details.", httpError.getMessage());
420+
Assertions.assertTrue(httpError.getDetails().contains("<h1>An error occurred.</h1>"));
421+
Assertions.assertEquals("", httpError.getCode());
420422
}
421423

422424
@Test
@@ -440,9 +442,9 @@ void givenError400_noDetails_mustThrowMindeeHttpException()
440442
new Endpoint(InvoiceV4.class),
441443
parseParameter)
442444
);
443-
assertEquals(400, httpError.getStatusCode());
444-
assertEquals("Some scary message here", httpError.getMessage());
445-
assertEquals("", httpError.getDetails());
446-
assertEquals("SomeCode", httpError.getCode());
445+
Assertions.assertEquals(400, httpError.getStatusCode());
446+
Assertions.assertEquals("Some scary message here", httpError.getMessage());
447+
Assertions.assertEquals("", httpError.getDetails());
448+
Assertions.assertEquals("SomeCode", httpError.getCode());
447449
}
448450
}

0 commit comments

Comments
 (0)