Skip to content

Commit

Permalink
fix: backend tests that caused the CI/CD pipeline to fail (#129)
Browse files Browse the repository at this point in the history
* fix: fixed the SendMoneyImpl test and CompareHashPassword test

* fix: fixed the SendMoneyImpl test and CompareHashPassword test

* test: commented defective tests

* test: uncommented defective tests

* fix(test): fixed the BackendHealthTest and ApplicationsTest
  • Loading branch information
kouamschekina committed Apr 11, 2024
1 parent 4555549 commit 8f24cc7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.adorsys.gis.powerpay.powerpaybackend.repository;

import com.adorsys.gis.powerpay.powerpaybackend.domain.Transaction;
import com.adorsys.gis.powerpay.powerpaybackend.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface UserRepository extends JpaRepository<Transaction, Long> {
Optional<User> findByUserId(String userId);
public interface UserRepository extends JpaRepository<User, String> {
Optional<User> findByPhoneNumber(String phoneNumber);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@ public class CheckBalanceController {
private final UserRepository userRepository;

@Autowired
public CheckBalanceController(CheckBalance checkBalanceService,UserRepository userRepository){
public CheckBalanceController(CheckBalance checkBalanceService, UserRepository userRepository) {
this.checkBalanceService = checkBalanceService;
this.userRepository = userRepository;
}

@GetMapping("/{userId}")
public ResponseEntity<String> checkBalance(@PathVariable String userId){
Optional<User> user = userRepository.findByUserId(userId);
if(user.isPresent()){
public ResponseEntity<String> checkBalance(@PathVariable String userId) {
Optional<User> user = userRepository.findByPhoneNumber(userId);
if (user.isPresent()) {
Double balance = checkBalanceService.checkBalance(userId);
return ResponseEntity.ok("Balance for user ID" + " : " +balance);
}
else {
return ResponseEntity.ok("Balance for user ID" + " : " + balance);
} else {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("User not found");
}
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import com.adorsys.gis.powerpay.powerpaybackend.services.SendMoneyImpl;

@RunWith(SpringRunner.class)
@SpringBootTest
@SpringBootTest(classes = {SendMoneyImpl.class})
public class SendMoneyImplTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.adorsys.gis.powerpay.powerpaybackend.utils_test;

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

import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import com.adorsys.gis.powerpay.powerpaybackend.utils.DataSecurityService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.*;
import static org.junit.jupiter.api.Assertions.assertTrue;

@SpringBootTest
@RunWith(SpringRunner.class)
@SpringBootTest(classes={DataSecurityService.class})
public class CompareHashPasswordTest {

@Autowired
Expand Down

0 comments on commit 8f24cc7

Please sign in to comment.