mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
* Remove year from messages containing "Wiki Loves Monuments 2021" * Retrieve Wiki Love Monuments year dynamically * Add test and doc
28 lines
No EOL
809 B
Kotlin
28 lines
No EOL
809 B
Kotlin
package fr.free.nrw.commons
|
|
|
|
import org.junit.Test
|
|
import org.junit.jupiter.api.Assertions
|
|
import java.util.*
|
|
|
|
class UtilsTest {
|
|
@Test
|
|
fun wikiLovesMonumentsYearBeforeSeptember() {
|
|
val cal = Calendar.getInstance()
|
|
cal.set(2022, Calendar.FEBRUARY, 1)
|
|
Assertions.assertEquals(2021, Utils.getWikiLovesMonumentsYear(cal))
|
|
}
|
|
|
|
@Test
|
|
fun wikiLovesMonumentsYearInSeptember() {
|
|
val cal = Calendar.getInstance()
|
|
cal.set(2022, Calendar.SEPTEMBER, 1)
|
|
Assertions.assertEquals(2022, Utils.getWikiLovesMonumentsYear(cal))
|
|
}
|
|
|
|
@Test
|
|
fun wikiLovesMonumentsYearAfterSeptember() {
|
|
val cal = Calendar.getInstance()
|
|
cal.set(2022, Calendar.DECEMBER, 1)
|
|
Assertions.assertEquals(2022, Utils.getWikiLovesMonumentsYear(cal))
|
|
}
|
|
} |