Feature/issue 90/spring controller unit tests#131
Merged
GerardChabaBristol merged 6 commits intodevfrom Jan 22, 2025
Merged
Conversation
Changed Spring Controller class to better work with dependency injection, so that it can be tested more efficiently
…llerTest.java Added unit tests for creating new users, revoking consent and creating chats
Contributor
|
Backend fails to start, it reports the following error: It may help to define a bean of type 'com.UoB.AILearningTool.DatabaseController' in our configuration. |
Contributor
|
I think that lines 20-24 in |
…BaseController and OpenAIAPIController classes, backend should now start
Contributor
Author
|
Issue should be fixed, forgot to update the annotation tag for DatabaseController and OpenAIAPIController |
…he code in SpringController.Java as 3 users are generated each time createChat is called, which causes testCreateChat to fail.
…chat once. This should make the test cleaner as well as simplify the testCreateChat method. Also changed some methods in SpringController.java to prevent potential NullPointerExceptions.
Contributor
Author
|
Tests should be fully functial now |
vladislav-k1
approved these changes
Jan 22, 2025
Contributor
vladislav-k1
left a comment
There was a problem hiding this comment.
The code works and makes sense.
GerardChabaBristol
approved these changes
Jan 22, 2025
Collaborator
GerardChabaBristol
left a comment
There was a problem hiding this comment.
Looks good, no more errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue(s):
#90
Type of change: (choose required ones)
Description:
Refactored SpringController class to work with dependency injection, making it easier to test.
Created unit tests for creating new user, revoking consent and creating new chats.
Additional context:
Unit tests are currently commented out until they can be tested on server.
Testing instructions:
Tests can be run seperately on Intellij IDE.