Compare commits

...

3 Commits

Author SHA1 Message Date
Korna 8bfb77326c Remove unnecessary syntax sugar from DateConverter 2022-11-07 16:12:04 +03:00
Korna 98dd75db72 Fix DateConverter location and method signature 2022-11-07 16:09:55 +03:00
Korna 74104a7413 Fix test invokations 2022-11-07 16:08:27 +03:00
2 changed files with 15 additions and 4 deletions

View File

@ -1,4 +1,4 @@
package ru.touchin.push.message.provider.fcm.configurations
package ru.touchin.push.message.provider.fcm.converters
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding
@ -14,8 +14,8 @@ class DateConverter(
private val simpleDateFormat: SimpleDateFormat
) : Converter<String, Date> {
override fun convert(source: String?): Date? {
return source?.let(simpleDateFormat::parse)
override fun convert(source: String): Date {
return simpleDateFormat.parse(source)
}
}

View File

@ -4,16 +4,19 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect
import com.fasterxml.jackson.annotation.PropertyAccessor
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.google.firebase.FirebaseApp
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.SpringBootConfiguration
import org.springframework.boot.test.context.TestConfiguration
import org.springframework.context.ApplicationListener
import org.springframework.context.annotation.Bean
import org.springframework.context.event.ContextRefreshedEvent
import java.text.SimpleDateFormat
@TestConfiguration
@SpringBootConfiguration
@EnablePushMessageProviderFcm
class PushMessageProviderFcmTestApplication {
class PushMessageProviderFcmTestApplication : ApplicationListener<ContextRefreshedEvent> {
@Bean
fun objectMapper(
@ -28,4 +31,12 @@ class PushMessageProviderFcmTestApplication {
}
}
override fun onApplicationEvent(event: ContextRefreshedEvent) {
clearSingletonsOutsideContainer()
}
private fun clearSingletonsOutsideContainer() {
FirebaseApp.getApps().forEach(FirebaseApp::delete)
}
}