Skip to content

Commit

Permalink
fix(backend): add throws exception to test suites
Browse files Browse the repository at this point in the history
  • Loading branch information
markkovari committed Jul 9, 2024
1 parent e27bb84 commit 13a7bfa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.greenfoxacademy.backend.controller;

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

import com.greenfoxacademy.backend.dtos.RegisterUserDto;
import com.greenfoxacademy.backend.repositories.UserRepository;
import com.greenfoxacademy.backend.services.UserService;
Expand All @@ -10,6 +8,8 @@
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.context.SpringBootTest;

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

/**
* This class runs a test that verifies if a user is successfully registered in the database.
*/
Expand All @@ -24,7 +24,7 @@ public class UserRegistrationTest {
private UserRepository userRepository;

@Test
public void userIsSuccessfulRegisteredInDatabase() {
public void userIsSuccessfulRegisteredInDatabase() throws Exception {
RegisterUserDto newUser = new RegisterUserDto();
newUser.setFirstName("John");
newUser.setLastName("Doe");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.greenfoxacademy.backend.controller;

import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

import com.greenfoxacademy.backend.dtos.RegisterUserDto;
import com.greenfoxacademy.backend.repositories.UserRepository;
import com.greenfoxacademy.backend.services.UserService;
Expand All @@ -12,6 +9,9 @@
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

/**
* This class runs a test to verify if the register method in the userService is properly called.
*/
Expand All @@ -27,7 +27,7 @@ public class UserServiceTest {
private UserController userController;

@Test
public void registerMethodIsSuccessfullyCalled() {
public void registerMethodIsSuccessfullyCalled() throws Exception {
RegisterUserDto registerUserDto = new RegisterUserDto();
registerUserDto.setFirstName("John");
registerUserDto.setLastName("Doe");
Expand Down

0 comments on commit 13a7bfa

Please sign in to comment.