1 | package org.expressolivre.cte.email; |
---|
2 | |
---|
3 | import java.lang.reflect.InvocationTargetException; |
---|
4 | import java.lang.reflect.Method; |
---|
5 | |
---|
6 | import org.apache.commons.lang.StringUtils; |
---|
7 | import org.expressolivre.cte.common.Config; |
---|
8 | import org.expressolivre.cte.common.PreferencesTestCase; |
---|
9 | import org.expressolivre.cte.pages.email.ExpressoMailPreferencesPage; |
---|
10 | import org.testng.annotations.Test; |
---|
11 | |
---|
12 | /** |
---|
13 | * @author L.F.Estivalet (Serpro) |
---|
14 | * |
---|
15 | * Created on Feb 3, 2011 at 11:07:04 AM |
---|
16 | * |
---|
17 | */ |
---|
18 | public class ExpressoMailPreferencesTestCase extends PreferencesTestCase { |
---|
19 | ExpressoMailPreferencesPage prefs; |
---|
20 | |
---|
21 | // @BeforeTest |
---|
22 | // public void gotoEmailPreferencesPage() { |
---|
23 | // openPreferencesPage(); |
---|
24 | // prefs = openEmailPreferencesPage(); |
---|
25 | // } |
---|
26 | |
---|
27 | @Test |
---|
28 | public void test() throws IllegalArgumentException, IllegalAccessException, |
---|
29 | InvocationTargetException { |
---|
30 | openPreferencesPage(); |
---|
31 | prefs = openEmailPreferencesPage(); |
---|
32 | |
---|
33 | Method[] methods = ExpressoMailPreferencesPage.class.getMethods(); |
---|
34 | for (Method method : methods) { |
---|
35 | if (method.getName().startsWith("set") |
---|
36 | && !method.getName().equals("setComboValue") |
---|
37 | && !method.getName().equals("setSavePreferences")) { |
---|
38 | String name = StringUtils.uncapitalize(method.getName() |
---|
39 | .substring(3)); |
---|
40 | System.out.println(name); |
---|
41 | String[] values = Config.getInstance().getEmailPreference(name) |
---|
42 | .split(","); |
---|
43 | System.out.println(name + " " + values[0]); |
---|
44 | method.invoke(prefs, values[0]); |
---|
45 | } |
---|
46 | } |
---|
47 | prefs.savePreferences(); |
---|
48 | |
---|
49 | } |
---|
50 | |
---|
51 | // @AfterTest |
---|
52 | // public void savePreferences() { |
---|
53 | // prefs.savePreferences(); |
---|
54 | // } |
---|
55 | |
---|
56 | } |
---|