|
|
@ -0,0 +1,26 @@ |
|
|
|
package org.example; |
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream; |
|
|
|
import java.io.PrintStream; |
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
class AdminTest { |
|
|
|
|
|
|
|
@org.junit.jupiter.api.Test |
|
|
|
void printAdminInfo() { |
|
|
|
Admin admin = new Admin("Aaron", "A1001", "Admin"); |
|
|
|
|
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
System.setOut(new PrintStream(outputStream)); |
|
|
|
|
|
|
|
admin.printAdminInfo(); |
|
|
|
|
|
|
|
String printedOutput = outputStream.toString().trim(); |
|
|
|
|
|
|
|
assertTrue(printedOutput.contains("Aaron")); |
|
|
|
assertTrue(printedOutput.contains("A1001")); |
|
|
|
assertTrue(printedOutput.contains("Admin")); |
|
|
|
|
|
|
|
} |
|
|
|
} |