Skip to content

Commit

Permalink
Added feature 11 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkw7 committed Dec 6, 2023
1 parent 9309d5e commit 4796ad1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion app/src/test/java/cse/gradle/Feature11Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,38 @@
package cse.gradle;

import org.junit.jupiter.api.Test;

import cse.gradle.Server.APIs.ChatGPTApi;
import cse.gradle.Server.APIs.DallEApi;
import cse.gradle.Server.APIs.MockDallEApiClient;
import cse.gradle.Server.APIs.MockGPT;

import static org.junit.jupiter.api.Assertions.*;
import java.util.ArrayList;


class Feature11Tests {
/* --------------------------------- UNIT TESTS --------------------------------- */

/* --------------------------------- BDD TESTS --------------------------------- */
@Test
public void testDalleGenerateResponse() {
// Create an instance of the MockGPT for testing
DallEApi dallEApi = new MockDallEApiClient();

try {
// Test the generateResponse method with mock data
String mockResponse = dallEApi.generateChatResponse("Mock prompt");

// Add assertions to verify the correctness of the response
assertNotNull(mockResponse);
// Check if the response is a valid URL
mockResponse = mockResponse.toLowerCase();
assertTrue(mockResponse.startsWith("http"));
assertTrue(mockResponse.contains(".jpg"));
} catch (Exception e) {
// Handle exceptions or fail the test if an unexpected exception occurs
fail("Exception occurred: " + e.getMessage());
}
}

}

0 comments on commit 4796ad1

Please sign in to comment.