Open snaag opened 2 years ago
junit -> assertEquals
Assertions.assertEquals(기대, 실제값)
-> 둘이 똑같은지 확인 가능package hello.hellospring.repository;
import hello.hellospring.domain.Member;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import javax.swing.text.html.Option;
import java.util.List;
import java.util.Optional;
@Test
public void save() {
Member member = new Member();
member.setName("spring");
repository.save(member);
Member result = repository.findById(member.getId()).get();
Assertions.assertEquals(result, member);
}
assertj -> assertThat
package hello.hellospring.repository;
import hello.hellospring.domain.Member;
import org.assertj.core.api.Assertions;
import javax.swing.text.html.Option;
import java.util.List;
import java.util.Optional;
@Test
public void save() {
Member member = new Member();
member.setName("spring");
repository.save(member);
Member result = repository.findById(member.getId()).get();
assertThat(member).isEqualTo(result);
}
@AfterEach
public void afterEach() {
repository.clearStore();
}
.get()
Member result1 = repository.findByName("spring1").get();