32 lines
952 B
Java
32 lines
952 B
Java
package com.example.developer;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
@SpringBootTest
|
|
class DeveloperServiceTest {
|
|
|
|
@Autowired
|
|
private DeveloperService developerService;
|
|
|
|
@Test
|
|
void getRole_returnsDeveloper() {
|
|
String role = developerService.getRole();
|
|
assertTrue("Developer".equals(role), "Role should be Developer");
|
|
}
|
|
|
|
@Test
|
|
void isValidRole_withDeveloper_returnsTrue() {
|
|
boolean valid = developerService.isValidRole("Developer");
|
|
assertTrue(valid, "Developer role should be valid");
|
|
}
|
|
|
|
@Test
|
|
void isValidRole_withOtherRole_returnsFalse() {
|
|
boolean valid = developerService.isValidRole("Admin");
|
|
assertTrue(!valid, "Admin role should not be valid for DeveloperService");
|
|
}
|
|
}
|