Added surefire and failsafe plugins

This commit is contained in:
Amith Koujalgi 2023-12-14 17:41:23 +05:30
parent f6af7025a8
commit b2d76970dc
4 changed files with 29 additions and 2 deletions

View File

@ -3,3 +3,6 @@ ut:
it: it:
mvn clean verify -Pintegration-tests mvn clean verify -Pintegration-tests
build:
mvn clean test install -Punit-tests

View File

@ -37,6 +37,7 @@ A Java library (wrapper/binding) for [Ollama](https://github.com/jmorganca/ollam
- [Installation](#installation) - [Installation](#installation)
- [Demo APIs](#try-out-the-apis) - [Demo APIs](#try-out-the-apis)
- [API Spec](#api-spec) - [API Spec](#api-spec)
- [Development](#development)
- [Contributions](#get-involved) - [Contributions](#get-involved)
#### Requirements #### Requirements
@ -340,6 +341,26 @@ public class Main {
Find the full `Javadoc` (API specifications) [here](https://amithkoujalgi.github.io/ollama4j/). Find the full `Javadoc` (API specifications) [here](https://amithkoujalgi.github.io/ollama4j/).
#### Development
Build:
```shell
make ut
```
Run unit tests:
```shell
make ut
```
Run integration tests:
```shell
make it
```
#### Areas of improvement #### Areas of improvement
- [x] Use Java-naming conventions for attributes in the request/response models instead of the snake-case conventions. ( - [x] Use Java-naming conventions for attributes in the request/response models instead of the snake-case conventions. (

View File

@ -127,6 +127,7 @@
<excludes> <excludes>
<exclude>**/unittests/*.java</exclude> <exclude>**/unittests/*.java</exclude>
</excludes> </excludes>
<skipTests>${skipIntegrationTests}</skipTests>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -189,6 +190,7 @@
<properties> <properties>
<test.env>unit</test.env> <test.env>unit</test.env>
<skipUnitTests>false</skipUnitTests> <skipUnitTests>false</skipUnitTests>
<skipIntegrationTests>true</skipIntegrationTests>
</properties> </properties>
</profile> </profile>
<profile> <profile>
@ -196,6 +198,7 @@
<properties> <properties>
<test.env>integration</test.env> <test.env>integration</test.env>
<skipUnitTests>true</skipUnitTests> <skipUnitTests>true</skipUnitTests>
<skipIntegrationTests>false</skipIntegrationTests>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>

View File

@ -101,7 +101,7 @@ public class TestRealAPIs {
String model = OllamaModelType.LLAMA2; String model = OllamaModelType.LLAMA2;
String prompt = "some prompt text"; String prompt = "some prompt text";
try { try {
when(ollamaAPI.ask(model, prompt)).thenReturn(new OllamaResult("", 0)); when(ollamaAPI.ask(model, prompt)).thenReturn(new OllamaResult("", 0,200));
ollamaAPI.ask(model, prompt); ollamaAPI.ask(model, prompt);
verify(ollamaAPI, times(1)).ask(model, prompt); verify(ollamaAPI, times(1)).ask(model, prompt);
} catch (IOException | OllamaBaseException | InterruptedException e) { } catch (IOException | OllamaBaseException | InterruptedException e) {