-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
69 deletions.
There are no files selected for viewing
34 changes: 0 additions & 34 deletions
34
src/test/java/com/akagiyui/drive/KenkoDriveApplicationTests.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/test/java/com/akagiyui/drive/config/SecurityConfigTest.java
This file was deleted.
Oops, something went wrong.
9 changes: 3 additions & 6 deletions
9
...agiyui/drive/notifier/GotifyPusherTest.kt → ...iyui/common/notifier/GotifyPusherTests.kt
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
31 changes: 31 additions & 0 deletions
31
src/test/kotlin/com/akagiyui/drive/KenkoDriveApplicationTests.kt
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,31 @@ | ||
package com.akagiyui.drive | ||
|
||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.context.MessageSource | ||
import org.springframework.context.i18n.LocaleContextHolder | ||
import java.util.* | ||
|
||
/** | ||
* @author AkagiYui | ||
*/ | ||
@SpringBootTest | ||
class KenkoDriveApplicationTests(@Autowired private val messageSource: MessageSource) { | ||
@Test | ||
fun contextLoads() { | ||
Assertions.assertEquals(1, 2 - 1) | ||
} | ||
|
||
@Test | ||
fun i18nTest() { | ||
val locale = LocaleContextHolder.getLocale() | ||
println("locale: $locale") | ||
if (locale == Locale.SIMPLIFIED_CHINESE) { | ||
Assertions.assertEquals("测试", messageSource.getMessage("TEST", arrayOf(), locale)) | ||
} else { | ||
Assertions.assertEquals("test", messageSource.getMessage("TEST", arrayOf(), locale)) | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/com/akagiyui/drive/config/SecurityConfigTests.kt
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,25 @@ | ||
package com.akagiyui.drive.config | ||
|
||
import org.junit.jupiter.api.Assertions | ||
import org.junit.jupiter.api.Test | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.security.crypto.password.PasswordEncoder | ||
|
||
/** | ||
* Spring Security 测试 | ||
* | ||
* @author AkagiYui | ||
*/ | ||
@SpringBootTest | ||
class SecurityConfigTests(@Autowired private val passwordEncoder: PasswordEncoder) { | ||
|
||
@Test | ||
fun passwordEncoder() { | ||
val encoded = passwordEncoder.encode("123456") | ||
println(encoded) | ||
Assertions.assertNotNull(encoded) | ||
Assertions.assertNotEquals("123456", encoded) | ||
} | ||
|
||
} |