Skip to content

Commit 72e30b6

Browse files
committed
Updated dependencies
1 parent 8e96698 commit 72e30b6

5 files changed

Lines changed: 26 additions & 28 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88
}
99

1010
// Append dependency
11-
implementation("com.icerockdev.service:email-service:0.2.0")
11+
implementation("com.icerockdev.service:email-service:0.3.0")
1212
````
1313

1414
## Library usage

email-service/build.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apply(plugin = "java")
1616
apply(plugin = "kotlin")
1717

1818
group = "com.icerockdev.service"
19-
version = "0.2.0"
19+
version = "0.3.0"
2020

2121
val sourcesJar by tasks.registering(Jar::class) {
2222
archiveClassifier.set("sources")
@@ -35,9 +35,6 @@ dependencies {
3535
// tests
3636
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:${properties["kotlin_version"]}")
3737
testImplementation(group = "com.github.kirviq", name = "dumbster", version = "1.7.1")
38-
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-all
39-
testImplementation(group = "org.hamcrest", name = "hamcrest-all", version = "1.3")
40-
4138
}
4239

4340
java {
@@ -108,6 +105,7 @@ publishing {
108105
}
109106

110107
signing {
108+
setRequired({!properties.containsKey("libraryPublishToMavenLocal")})
111109
val signingKeyId: String? = System.getenv("SIGNING_KEY_ID")
112110
val signingPassword: String? = System.getenv("SIGNING_PASSWORD")
113111
val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key ->

email-service/src/test/kotlin/EmailTest.kt

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ import kotlinx.coroutines.CoroutineScope
99
import kotlinx.coroutines.Dispatchers
1010
import kotlinx.coroutines.SupervisorJob
1111
import kotlinx.coroutines.runBlocking
12-
import org.hamcrest.Matchers.*
1312
import org.junit.After
14-
import org.junit.Assert.assertThat
1513
import org.junit.Before
1614
import org.junit.Test
15+
import kotlin.test.assertContains
16+
import kotlin.test.assertEquals
17+
import kotlin.test.assertTrue
1718

1819

1920
class EmailTest {
20-
21-
private var server: SimpleSmtpServer? = null
21+
private lateinit var server: SimpleSmtpServer
22+
private lateinit var mailerService: MailerService
2223
private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
23-
private var mailerService: MailerService? = null
2424

2525
@Before
2626
fun setUp() {
@@ -29,22 +29,22 @@ class EmailTest {
2929
scope,
3030
SMTPConfig(
3131
host = "localhost",
32-
port = server!!.port
32+
port = server.port
3333
)
3434
)
3535
}
3636

3737
@After
3838
@Throws(Exception::class)
3939
fun tearDown() {
40-
server?.stop()
40+
server.stop()
4141
}
4242

4343
@Test
4444
fun testSend() {
4545

4646
runBlocking {
47-
mailerService!!.compose().apply {
47+
mailerService.compose().apply {
4848
fromEmail = "from@icerockdev.com"
4949
fromName = "From Person"
5050
subject = "TEST EMAIL"
@@ -54,16 +54,16 @@ class EmailTest {
5454
.join()
5555
}
5656

57-
val emails = server!!.receivedEmails
58-
assertThat(emails, hasSize(1))
57+
val emails = server.receivedEmails
58+
assertEquals(expected = 1, actual = emails.size)
5959
val email = emails[0]
60-
assertThat(email.getHeaderValue("Subject"), `is`("TEST EMAIL"))
61-
assertThat(email.body, containsString("<h1>Test test test</h1>"))
62-
assertThat(email.headerNames, hasItem("Date"))
63-
assertThat(email.headerNames, hasItem("From"))
64-
assertThat(email.headerNames, hasItem("To"))
65-
assertThat(email.headerNames, hasItem("Subject"))
66-
assertThat(email.getHeaderValues("To"), contains("Test Person <to@icerockdev.com>"))
67-
assertThat(email.getHeaderValue("To"), `is`("Test Person <to@icerockdev.com>"))
60+
61+
assertEquals(expected = "TEST EMAIL", actual = email.getHeaderValue("Subject"))
62+
assertContains(email.body, "<h1>Test test test</h1>")
63+
assertTrue { email.headerNames.contains("Date") }
64+
assertTrue { email.headerNames.contains("From") }
65+
assertTrue { email.headerNames.contains("To") }
66+
assertEquals(expected = 1, email.getHeaderValues("To").size)
67+
assertTrue { email.getHeaderValues("To").contains("Test Person <to@icerockdev.com>") }
6868
}
69-
}
69+
}

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ org.gradle.jvmargs=-Xmx4096m
22
org.gradle.configureondemand=false
33
org.gradle.parallel=true
44

5-
logback_version=1.2.11
5+
logback_version=1.4.5
66
kotlin.code.style=official
7-
kotlin_version=1.6.10
8-
coroutines_version=1.6.0
7+
kotlin_version=1.7.21
8+
coroutines_version=1.6.4
99
common_email_version=1.5

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ include(":email-service")
2828
//
2929
val properties = startParameter.projectProperties
3030

31-
// ./gradlew -PlibraryPublish publishToMavenLocal
31+
// ./gradlew -PlibraryPublish -PlibraryPublishToMavenLocal publishToMavenLocal
3232
// ./gradlew :email-service:publish -PlibraryPublish
3333
val libraryPublish: Boolean = properties.containsKey("libraryPublish")
3434
if(!libraryPublish) {

0 commit comments

Comments
 (0)