-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- MessageSender interface 작성 - ConsoleLogMessageSender 작성 - ConsoleLogMessageSenderTest 작성 - 기존 코드 변경
- Loading branch information
Showing
5 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/main/java/flab/quing/waiting/ConsoleLogMessageSender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package flab.quing.waiting; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Slf4j | ||
@Component | ||
public class ConsoleLogMessageSender implements MessageSender { | ||
|
||
@Override | ||
public boolean send(String phoneNumber, String message) { | ||
log.info("phoneNumber = " + phoneNumber); | ||
log.info("message = " + message); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package flab.quing.waiting; | ||
|
||
public interface MessageSender { | ||
|
||
boolean send(String phoneNumber, String message); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/test/java/flab/quing/waiting/ConsoleLogMessageSenderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package flab.quing.waiting; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.boot.test.system.CapturedOutput; | ||
import org.springframework.boot.test.system.OutputCaptureExtension; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
@ExtendWith(OutputCaptureExtension.class) | ||
class ConsoleLogMessageSenderTest { | ||
|
||
MessageSender messageSender; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
messageSender = new ConsoleLogMessageSender(); | ||
} | ||
|
||
@Test | ||
void send(CapturedOutput output) { | ||
messageSender.send("010-0000-0000", "hi test"); | ||
|
||
Assertions.assertThat(output).contains("test"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters