diff --git a/app/build.gradle b/app/build.gradle
index c358341..cdc7051 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -102,6 +102,10 @@ dependencies {
implementation 'com.sun.mail:android-mail:1.6.7'
implementation 'com.sun.mail:android-activation:1.6.7'
+
+ // Email Testing
+ implementation('dumbster:dumbster:1.5')
+
// Image view
implementation 'com.github.stfalcon:stfalcon-imageviewer:0.1.0'
}
diff --git a/app/src/androidTest/java/at/team30/setroute/FeedbackTest.kt b/app/src/androidTest/java/at/team30/setroute/FeedbackTest.kt
new file mode 100644
index 0000000..f7934e5
--- /dev/null
+++ b/app/src/androidTest/java/at/team30/setroute/FeedbackTest.kt
@@ -0,0 +1,69 @@
+package at.team30.setroute
+
+import android.Manifest
+import android.widget.EditText
+import androidx.test.espresso.Espresso
+import androidx.test.espresso.action.ViewActions
+import androidx.test.espresso.matcher.ViewMatchers
+import at.team30.setroute.R
+import at.team30.setroute.infrastructure.DependencyInjection
+import at.team30.setroute.infrastructure.IRoutesRepository
+import at.team30.setroute.ui.MainActivity
+import dagger.hilt.android.testing.HiltAndroidRule
+import dagger.hilt.android.testing.HiltAndroidTest
+import dagger.hilt.android.testing.UninstallModules
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import javax.inject.Inject
+import androidx.test.espresso.Espresso.onView
+import androidx.test.espresso.action.ViewActions.*
+import androidx.test.espresso.assertion.ViewAssertions.matches
+import androidx.test.espresso.matcher.ViewMatchers.*
+import androidx.test.ext.junit.rules.ActivityScenarioRule
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.rule.GrantPermissionRule
+import org.hamcrest.Matchers.not
+
+@UninstallModules(DependencyInjection::class)
+@HiltAndroidTest
+class FeedbackTest {
+
+ @get:Rule(order = 0)
+ var hiltRule = HiltAndroidRule(this)
+
+ @get:Rule(order = 1)
+ val activityRule = ActivityScenarioRule(MainActivity::class.java)
+
+ @get:Rule(order = 2)
+ val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(Manifest.permission.ACCESS_FINE_LOCATION)
+
+ @Inject
+ lateinit var routesRepository: IRoutesRepository
+
+ @Before
+ fun init() {
+ hiltRule.inject()
+ }
+
+ @Test
+ fun feedbackButtonDisabledWithoutText() {
+ onView(withId(R.id.settingsFragment)).perform(click())
+ onView(withId(R.id.feedback_text_field)).perform(clearText())
+ onView(withId(R.id.submit_feedback_button)).check(matches(not(isEnabled())))
+ }
+
+ @Test
+ fun feedbackButtonDisabledWithLongText() {
+ onView(withId(R.id.settingsFragment)).perform(click())
+ onView(withId(R.id.feedback_text_field)).perform(clearText(), typeText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea"))
+ onView(withId(R.id.submit_feedback_button)).check(matches(not(isEnabled())))
+ }
+
+ @Test
+ fun feedbackButtonEnabled() {
+ onView(withId(R.id.settingsFragment)).perform(click())
+ onView(withId(R.id.feedback_text_field)).perform(clearText(), typeText("Feedback"))
+ onView(withId(R.id.submit_feedback_button)).check(matches(isEnabled()))
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_baseline_beer_white.xml b/app/src/main/res/drawable/ic_baseline_beer_white.xml
index d31eaf8..49585cb 100644
--- a/app/src/main/res/drawable/ic_baseline_beer_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_beer_white.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/drawable/ic_baseline_coffee_white.xml b/app/src/main/res/drawable/ic_baseline_coffee_white.xml
index a6dd9df..f7a1cb4 100644
--- a/app/src/main/res/drawable/ic_baseline_coffee_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_coffee_white.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/drawable/ic_baseline_park_lovers_white.xml b/app/src/main/res/drawable/ic_baseline_park_lovers_white.xml
index df364d9..0152048 100644
--- a/app/src/main/res/drawable/ic_baseline_park_lovers_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_park_lovers_white.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/drawable/ic_baseline_pets_white.xml b/app/src/main/res/drawable/ic_baseline_pets_white.xml
index 2829ab5..6cdd1b0 100644
--- a/app/src/main/res/drawable/ic_baseline_pets_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_pets_white.xml
@@ -1,9 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_romantic_walk_white.xml b/app/src/main/res/drawable/ic_baseline_romantic_walk_white.xml
index 2d9d13c..aae0d18 100644
--- a/app/src/main/res/drawable/ic_baseline_romantic_walk_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_romantic_walk_white.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/drawable/ic_baseline_sights_white.xml b/app/src/main/res/drawable/ic_baseline_sights_white.xml
index 6e38d2f..77a158c 100644
--- a/app/src/main/res/drawable/ic_baseline_sights_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_sights_white.xml
@@ -1,9 +1,9 @@
-
-
-
-
-
-
+
+
+
+
+
diff --git a/app/src/main/res/drawable/ic_baseline_sport_freaks_white.xml b/app/src/main/res/drawable/ic_baseline_sport_freaks_white.xml
index fbe43a5..b0169f3 100644
--- a/app/src/main/res/drawable/ic_baseline_sport_freaks_white.xml
+++ b/app/src/main/res/drawable/ic_baseline_sport_freaks_white.xml
@@ -1,5 +1,5 @@
-
-
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 3faf933..82cb111 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -10,4 +10,5 @@
+
\ No newline at end of file
diff --git a/app/src/test/java/at/team30/setroute/EmailTest.kt b/app/src/test/java/at/team30/setroute/EmailTest.kt
new file mode 100644
index 0000000..5284eb1
--- /dev/null
+++ b/app/src/test/java/at/team30/setroute/EmailTest.kt
@@ -0,0 +1,78 @@
+package at.team30.setroute
+
+import android.widget.EditText
+import at.team30.setroute.Helper.EmailHelper
+import com.dumbster.smtp.SimpleSmtpServer
+import kotlinx.coroutines.runBlocking
+import org.junit.Assert
+import org.junit.Before
+import org.junit.Ignore
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+import java.lang.IllegalArgumentException
+
+@RunWith(JUnit4::class)
+class EmailTest {
+
+ lateinit var emailHelper : EmailHelper
+ lateinit var smtpServer : SimpleSmtpServer
+ var port = 666
+
+ @Test(expected = IllegalArgumentException::class)
+ fun initIllegalArgumentsNoUsername() {
+ EmailHelper(
+ authenticate = true,
+ userName = null
+ )
+ }
+
+ @Test(expected = IllegalArgumentException::class)
+ fun initIllegalArgumentsNoPassword() {
+ EmailHelper(
+ authenticate = true,
+ userName = "Max Musterman",
+ password = null
+ )
+ }
+
+
+
+ @Test
+ fun createEmailHelperWithoutAuthentication() {
+ EmailHelper(
+ authenticate = false,
+ userName = "Max Musterman",
+ password = null
+ )
+ }
+
+ @Before
+ fun setUpTest() {
+ smtpServer = SimpleSmtpServer(port)
+ }
+
+ @Test
+ @Ignore
+ fun emailReceived() {
+ var text = "Very best feedback."
+ var receiver = "some@anything.org"
+ var subject = "Very important issue"
+
+ emailHelper = EmailHelper(
+ smtpHost = "localhost",
+ smtpPort = port,
+ enableStartTtls = false,
+ userName = null,
+ password = null,
+ sender = "bestemail@provider.com",
+ authenticate = false
+ )
+
+ runBlocking {
+ emailHelper.sendEmail(text, receiver, subject)
+ }
+ Assert.assertEquals(1, smtpServer.receivedEmailSize)
+ }
+
+}
\ No newline at end of file