diff --git a/declex-test/app/src/main/java/com/dspot/declex/test/dialog/toastdialog/ModelBean.java b/declex-test/app/src/main/java/com/dspot/declex/test/dialog/toastdialog/ModelBean.java new file mode 100644 index 00000000..6d4f37c8 --- /dev/null +++ b/declex-test/app/src/main/java/com/dspot/declex/test/dialog/toastdialog/ModelBean.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2016-2017 DSpot Sp. z o.o + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.dspot.declex.test.dialog.toastdialog; + +import com.dspot.declex.test.R; + +import static com.dspot.declex.actions.Action.*; + +import org.androidannotations.annotations.EBean; + + +@EBean +public class ModelBean { + public void showMessage() { + $Toast("DecleX Test Now"); + } + + public void showMessageUsingResources() { + $Toast(R.string.message); + } +} diff --git a/declex-test/app/src/main/res/values/strings.xml b/declex-test/app/src/main/res/values/strings.xml index 9fe24759..7a502982 100644 --- a/declex-test/app/src/main/res/values/strings.xml +++ b/declex-test/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ DecleX Test + DecleX Test Now diff --git a/declex-test/app/src/test/java/com/dspot/declex/test/dialog/toastdialog/TestToastDialog.java b/declex-test/app/src/test/java/com/dspot/declex/test/dialog/toastdialog/TestToastDialog.java new file mode 100644 index 00000000..676b06cf --- /dev/null +++ b/declex-test/app/src/test/java/com/dspot/declex/test/dialog/toastdialog/TestToastDialog.java @@ -0,0 +1,55 @@ +package com.dspot.declex.test.dialog.toastdialog; + +import com.dspot.declex.actions.ToastActionHolder_; +import com.dspot.declex.test.R; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.rule.PowerMockRule; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +@RunWith(RobolectricTestRunner.class) +@Config( + manifest = "app/src/main/AndroidManifest.xml", + sdk = 25 +) +@PowerMockIgnore({ "org.mockito.*", "org.robolectric.*", "android.*", "org.powermock.*" }) +@PrepareForTest({ToastActionHolder_.class}) +public class TestToastDialog { + + @Rule + public PowerMockRule rule = new PowerMockRule(); + + @Before + public void setUp() throws Exception { + + } + + @Test + public void testToastDialogAction() { + ToastActionHolder_ actionToastDialog = ToastActionHolder_.getInstance_(RuntimeEnvironment.application); + assertNotNull(actionToastDialog); + } + + @Test + public void testToastDialogActionProperties() { + ToastActionHolder_ actionToastDialog = ToastActionHolder_.getInstance_(RuntimeEnvironment.application); + actionToastDialog.init("DecleX Test Now"); + assertNotNull(actionToastDialog); + } + + @Test + public void testToastDialogActionResources() { + ToastActionHolder_ actionToastDialog = ToastActionHolder_.getInstance_(RuntimeEnvironment.application); + actionToastDialog.init(R.string.message); + assertNotNull(actionToastDialog); + } +} \ No newline at end of file