-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fix] MVC 컨트롤러에서 byte[] 아닌 String으로 받도록 수정 (#70)
- Loading branch information
Showing
7 changed files
with
61 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
public record RecordCreateRequest( | ||
String location, | ||
String content, | ||
byte[] keywords) { | ||
String keywords) { | ||
} |
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
39 changes: 39 additions & 0 deletions
39
src/test/java/org/recordy/server/keyword/domain/KeywordTest.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,39 @@ | ||
package org.recordy.server.keyword.domain; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Base64; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.junit.jupiter.api.Assertions.assertAll; | ||
|
||
class KeywordTest { | ||
|
||
@Test | ||
void encode를_통해_모든_키워드를_utf8로_인코딩할_수_있다() { | ||
// given, when | ||
String encodedKeywords = Keyword.encode(); | ||
List<Keyword> keywords = Keyword.decode(encodedKeywords); | ||
|
||
// then | ||
assertAll( | ||
() -> assertThat(keywords.size()).isEqualTo(Keyword.values().length) | ||
); | ||
} | ||
|
||
@Test | ||
void decode를_통해_콤마로_연결된_채_인코딩된_문자열_utf8_코드를_해독하여_키워드_리스트로_디코딩할_수_있다() { | ||
// given | ||
String code = Base64.getEncoder().encodeToString("감각적인,강렬한".getBytes()); | ||
|
||
// when | ||
List<Keyword> keywords = Keyword.decode(code); | ||
|
||
// then | ||
assertAll( | ||
() -> assertThat(keywords.get(0)).isEqualTo(Keyword.감각적인), | ||
() -> assertThat(keywords.get(1)).isEqualTo(Keyword.강렬한) | ||
); | ||
} | ||
} |