Skip to content

Commit

Permalink
feat: 메서드 기준 충족을 위한 테스트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeShinHaeng committed Dec 9, 2024
1 parent 8abeadc commit a70045a
Showing 1 changed file with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package professor.domain;

import static kgu.developers.domain.professor.domain.Role.ASSISTANT;
import static kgu.developers.domain.professor.domain.Role.PROFESSOR;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down Expand Up @@ -31,4 +32,76 @@ public void createProfessor_Success() {
assertEquals(contact, professor.getContact());
assertEquals(email, professor.getEmail());
}

@Test
@DisplayName("PROFESSOR 객체의 이름을 수정할 수 있다")
public void updateName_Success() {
// given
String name = "박민준";
Role role = PROFESSOR;
String contact = "010-1234-5678";
String email = "[email protected]";
Professor professor = Professor.create(name, role, contact, email);

// when
String newName = "이신행";
professor.updateName(newName);

// then
assertEquals(newName, professor.getName());
}

@Test
@DisplayName("PROFESSOR 객체의 역할을 수정할 수 있다")
public void updateRole_Success() {
// given
String name = "박민준";
Role role = PROFESSOR;
String contact = "010-1234-5678";
String email = "[email protected]";
Professor professor = Professor.create(name, role, contact, email);

// when
Role newRole = ASSISTANT;
professor.updateRole(newRole);

// then
assertEquals(newRole, professor.getRole());
}

@Test
@DisplayName("PROFESSOR 객체의 연락처를 수정할 수 있다")
public void updateContact_Success() {
// given
String name = "박민준";
Role role = PROFESSOR;
String contact = "010-1234-5678";
String email = "[email protected]";
Professor professor = Professor.create(name, role, contact, email);

// when
String newContact = "010-1234-8765";
professor.updateContact(newContact);

// then
assertEquals(newContact, professor.getContact());
}

@Test
@DisplayName("PROFESSOR 객체의 메일을 수정할 수 있다")
public void updateEmail_Success() {
// given
String name = "박민준";
Role role = PROFESSOR;
String contact = "010-1234-5678";
String email = "[email protected]";
Professor professor = Professor.create(name, role, contact, email);

// when
String newEmail = "[email protected]";
professor.updateEmail(newEmail);

// then
assertEquals(newEmail, professor.getEmail());
}
}

0 comments on commit a70045a

Please sign in to comment.