ZDenizYStenhaug / swe573-Project

Project repository for SWE573 - Software Development Practice
0 stars 0 forks source link

Junit research #23

Closed ZDenizYStenhaug closed 2 years ago

ZDenizYStenhaug commented 2 years ago

Research integration testing and testing of the functions in the backend that depend on the database.

ZDenizYStenhaug commented 2 years ago

For the repository tests, the example below could be applied to most of the cases:


@Test
    public void testCreateUser() {
        Member member = new Member();
        member.setEmail("ravikumar@gmail.com");
        member.setPassword("ravi2020");
        member.setUsername("melon");

        Member savedUser = memberRepo.save(member);

        Member existUser = testEntityManager.find(Member.class, savedUser.getId());

        assertThat(member.getEmail()).isEqualTo(existUser.getEmail());
    }