Skip to content

Commit cd9811a

Browse files
committed
feat(kodein-sample): rename create() -> new()
1 parent 0e96b80 commit cd9811a

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

kodein-sample/src/main/kotlin/MainEnvironment.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import javax.sql.DataSource
2020
object MainEnvironment {
2121
val diContainer = Kodein {
2222
bind<DataSource>() with singleton {
23-
MySqlDataSourceFactory.create("localhost", 3306, "kodein_sample", "root", "")
23+
MySqlDataSourceFactory.new("localhost", 3306, "kodein_sample", "root", "")
2424
}
2525

2626
bind<Transactional>() with singleton { MySqlTransactional(instance()) }

kodein-sample/src/main/kotlin/database/MySqlDataSourceFactory.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.zaxxer.hikari.HikariDataSource
44
import javax.sql.DataSource
55

66
object MySqlDataSourceFactory {
7-
fun create(host: String, port: Int, dbName: String, user: String, password: String): DataSource {
7+
fun new(host: String, port: Int, dbName: String, user: String, password: String): DataSource {
88
val ds = HikariDataSource()
99
ds.driverClassName = "org.mariadb.jdbc.Driver"
1010
ds.jdbcUrl = "jdbc:mysql://$host:$port/$dbName"

kodein-sample/src/test/kotlin/TestDataSourceFactory.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import com.ynojima.kodeinsample.database.MySqlDataSourceFactory
22
import javax.sql.DataSource
33

44
object TestDataSourceFactory {
5-
fun create(): DataSource =
6-
MySqlDataSourceFactory.create("localhost", 3306, "kodein_sample", "root", "")
5+
fun new(): DataSource =
6+
MySqlDataSourceFactory.new("localhost", 3306, "kodein_sample", "root", "")
77
}

kodein-sample/src/test/kotlin/TestJavalin.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import com.ynojima.kodeinsample.controller.GeneralErrorController
22
import io.javalin.Javalin
33

44
object TestJavalin {
5-
fun create(): Javalin {
5+
fun new(): Javalin {
66
val app = Javalin.create { config ->
77
config.showJavalinBanner = false
88
config.enableDevLogging()

kodein-sample/src/test/kotlin/componenttest/ComponentTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ComponentTest {
2727
// ポートが被らないようにランダムポートを使うようにする
2828
constant(tag = "listeningPort", overrides = true) with 0
2929
// テスト用のMySQLを使う
30-
bind<DataSource>(overrides = true) with singleton { TestDataSourceFactory.create() }
30+
bind<DataSource>(overrides = true) with singleton { TestDataSourceFactory.new() }
3131
}
3232

3333
private val app = Application(diContainer)

kodein-sample/src/test/kotlin/controller/GetUserControllerTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test
2323

2424
internal class GetUserControllerTest {
2525
private val getUserUseCase = mock<GetUserUseCase>()
26-
private val app = TestJavalin.create().also {
26+
private val app = TestJavalin.new().also {
2727
GetUserController(it, getUserUseCase)
2828
}
2929

kodein-sample/src/test/kotlin/controller/SignUpControllerTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import org.junit.jupiter.params.provider.EnumSource
2626

2727
internal class SignUpControllerTest {
2828
private val signUpUseCase = mock<SignUpUseCase>()
29-
private val app = TestJavalin.create().also {
29+
private val app = TestJavalin.new().also {
3030
SignUpController(it, signUpUseCase)
3131
}
3232

kodein-sample/src/test/kotlin/repository/impl/MySqlUserRepositoryTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import com.ynojima.kodeinsample.repository.Transactional
66
import com.ynojima.kodeinsample.repository.impl.MySqlTransactional
77

88
internal class MySqlUserRepositoryTest : UserRepositoryTest() {
9-
private val dataSource = TestDataSourceFactory.create()
9+
private val dataSource = TestDataSourceFactory.new()
1010
override val transactional: Transactional = MySqlTransactional(dataSource)
1111

1212
init {

0 commit comments

Comments
 (0)