Skip to content

ChallengeServiceTest failure #1

@Frank-Xiao2002

Description

@Frank-Xiao2002

Using mock at this step in ChallengeServiceTest.java is not appropriate since it will return null after running JPA repo methods like save etc. It should use @SpringBootTest and @Autowired to inject beans to test the service layer.

@SpringBootTest
public class ChallengeServiceTest {

    private ChallengeService challengeService;
//    @Mock
    @Autowired
    private UserRepository userRepository;

//    @Mock
    @Autowired
    private ChallengeAttemptRepository attemptRepository;

......
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions