Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .idea/runConfigurations/Print_not_ready_for_CI_tests.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package com.flowcrypt.email

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.flowcrypt.email.junit.annotations.DebugTest
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -17,7 +18,7 @@ import org.junit.runner.RunWith
* E-mail: DenBond7@gmail.com
*/
@SmallTest
@DebugTestAnnotation
@DebugTest
@RunWith(AndroidJUnit4::class)
class DebugTestingTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import com.flowcrypt.email.DoesNotNeedMailserver
import com.flowcrypt.email.ReadyForCIAnnotation
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -46,8 +44,6 @@ class MigrationTest {
)

@Test
@DoesNotNeedMailserver
@ReadyForCIAnnotation
@Throws(IOException::class)
fun testAllMigrations() {
// Create earliest version of the database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Contributors: DenBond7
*/

package com.flowcrypt.email
package com.flowcrypt.email.junit.annotations

/**
* This annotation was created for debugging purposes
Expand All @@ -14,4 +14,4 @@ package com.flowcrypt.email
* E-mail: DenBond7@gmail.com
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DebugTestAnnotation
annotation class DebugTest
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* Contributors: DenBond7
*/

package com.flowcrypt.email
package com.flowcrypt.email.junit.annotations

/**
* This annotation indicates that a whole class or a single method doesn't need an email server for successful
* completion.
* This annotation indicates that a whole class or a single method depends on an email server
* for successful completion.
*
* @author Denis Bondarenko
* Date: 7/11/19
* Time: 2:28 PM
* E-mail: DenBond7@gmail.com
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class DoesNotNeedMailserver
annotation class DependsOnMailServer
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
* Contributors: DenBond7
*/

package com.flowcrypt.email
package com.flowcrypt.email.junit.annotations

/**
* Via this annotation, we can mark a class or a method that can be run on CI.
* Via this annotation, we can mark a class or a method that can't be run on CI yet.
* Thanks to this annotation we can run all such methods by one call via the command line to check them.
*
* @author Denis Bondarenko
Expand All @@ -15,4 +15,4 @@ package com.flowcrypt.email
* E-mail: DenBond7@gmail.com
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
annotation class ReadyForCIAnnotation
annotation class NotReadyForCI
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package com.flowcrypt.email.junit.filters

import com.flowcrypt.email.DoesNotNeedMailserver
import com.flowcrypt.email.junit.annotations.DependsOnMailServer
import org.junit.runner.Description

/**
Expand All @@ -16,10 +16,10 @@ import org.junit.runner.Description
*/
class DependsOnMailServerFilter : ReadyForCIFilter() {
override fun evaluateTest(description: Description?): Boolean {
val annotationClass = DoesNotNeedMailserver::class.java
val hasClassAnnotation = description?.testClass?.isAnnotationPresent(annotationClass) == true
if (hasClassAnnotation) return false
return super.evaluateTest(description) && description?.getAnnotation(annotationClass) == null
val annotationClass = DependsOnMailServer::class.java
return super.evaluateTest(description)
&& (description?.testClass?.isAnnotationPresent(annotationClass) == true
|| description?.getAnnotation(annotationClass) != null)
}

override fun describe() = "Filter tests that depend on an email server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package com.flowcrypt.email.junit.filters

import com.flowcrypt.email.DoesNotNeedMailserver
import com.flowcrypt.email.junit.annotations.DependsOnMailServer
import org.junit.runner.Description

/**
Expand All @@ -16,10 +16,10 @@ import org.junit.runner.Description
*/
class DoesNotNeedMailServerFilter : ReadyForCIFilter() {
override fun evaluateTest(description: Description?): Boolean {
val annotationClass = DoesNotNeedMailserver::class.java
return super.evaluateTest(description)
&& (description?.testClass?.isAnnotationPresent(annotationClass) == true
|| description?.getAnnotation(annotationClass) != null)
val annotationClass = DependsOnMailServer::class.java
val hasClassAnnotation = description?.testClass?.isAnnotationPresent(annotationClass) == true
if (hasClassAnnotation) return false
return super.evaluateTest(description) && description?.getAnnotation(annotationClass) == null
}

override fun describe() = "Filter tests that don't need an email server"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
* Contributors: DenBond7
*/

package com.flowcrypt.email.junit.filters

import androidx.test.internal.runner.filters.ParentFilter
import com.flowcrypt.email.junit.annotations.NotReadyForCI
import org.junit.runner.Description

/**
* @author Denis Bondarenko
* Date: 2/17/21
* Time: 5:24 PM
* E-mail: DenBond7@gmail.com
*/
open class NotReadyForCIFilter : ParentFilter() {
override fun evaluateTest(description: Description?): Boolean {
val annotationClass = NotReadyForCI::class.java
return (description?.testClass?.isAnnotationPresent(annotationClass) == true
|| description?.getAnnotation(annotationClass) != null)
}

override fun describe() = "Filter tests that can't be run on CI yet"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package com.flowcrypt.email.junit.filters

import androidx.test.internal.runner.filters.ParentFilter
import com.flowcrypt.email.ReadyForCIAnnotation
import com.flowcrypt.email.junit.annotations.NotReadyForCI
import org.junit.runner.Description

/**
Expand All @@ -17,8 +17,8 @@ import org.junit.runner.Description
*/
open class ReadyForCIFilter : ParentFilter() {
override fun evaluateTest(description: Description?): Boolean {
val annotationClass = ReadyForCIAnnotation::class.java
return (description?.testClass?.isAnnotationPresent(annotationClass) == true || description?.getAnnotation(annotationClass) != null)
val annotationClass = NotReadyForCI::class.java
return (description?.testClass?.isAnnotationPresent(annotationClass) == false && description.getAnnotation(annotationClass) == null)
}

override fun describe() = "Filter tests that are ready to be run on a CI server"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import android.util.Base64OutputStream
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
import com.flowcrypt.email.DoesNotNeedMailserver
import com.flowcrypt.email.ReadyForCIAnnotation
import com.flowcrypt.email.api.email.MsgsCacheManager
import com.flowcrypt.email.util.exception.SyncTaskTerminatedException
import okio.buffer
Expand Down Expand Up @@ -53,8 +51,6 @@ class KeyStoreCryptoManagerTest {
}

@Test
@DoesNotNeedMailserver
@ReadyForCIAnnotation
fun testDataAsString() {
val encryptedData = KeyStoreCryptoManager.encrypt(originalData)
println(encryptedData)
Expand All @@ -64,8 +60,6 @@ class KeyStoreCryptoManagerTest {
}

@Test
@DoesNotNeedMailserver
@ReadyForCIAnnotation
fun testDataAsStream() {
val msg = MimeMessage(Session.getInstance(Properties()), InstrumentationRegistry
.getInstrumentation().context.assets.open("messages/mime/standard_msg_info_plain_text.txt"))
Expand Down Expand Up @@ -105,8 +99,6 @@ class KeyStoreCryptoManagerTest {
}

@Test
@DoesNotNeedMailserver
@ReadyForCIAnnotation
fun testDataAsStreamFromCacheManager() {
val msg = MimeMessage(Session.getInstance(Properties()), InstrumentationRegistry
.getInstrumentation().context.assets.open("messages/mime/standard_msg_info_plain_text.txt"))
Expand Down
Loading