-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSuggestionsTest.java
More file actions
51 lines (46 loc) · 1.69 KB
/
Copy pathSuggestionsTest.java
File metadata and controls
51 lines (46 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package Model;
import com.lob.model.Suggestions;
import org.testng.annotations.*;
import org.testng.Assert;
public class SuggestionsTest {
@DataProvider (name = "suggestions-data-provider")
public Object[][] suggestionsDpMethod(){
return new Object[][] {
{"primary_line", ""},
{"city", ""},
{"state", ""},
{"zip_code", "11111"},
{"object", Suggestions.ObjectEnum.US_AUTOCOMPLETION},
};
}
@Test(enabled=true, dataProvider = "suggestions-data-provider")
public void suggestionsTestWithProvidedValue(String prop, Object val) {
Suggestions rec = new Suggestions();
if (prop == "object") {
Suggestions.ObjectEnum castedVal = (Suggestions.ObjectEnum)val;
rec.setObject(castedVal);
Assert.assertEquals(rec.getObject(), castedVal);
} else {
String castedVal = (String)val;
switch (prop) {
case "primary_line":
rec.setPrimaryLine(castedVal);
Assert.assertEquals(rec.getPrimaryLine(), castedVal);
break;
case "city":
rec.setCity(castedVal);
Assert.assertEquals(rec.getCity(), castedVal);
break;
case "state":
rec.setState(castedVal);
Assert.assertEquals(rec.getState(), castedVal);
break;
case "zip_code":
rec.setZipCode(castedVal);
Assert.assertEquals(rec.getZipCode(), castedVal);
break;
default:
}
}
}
}