-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCardEditableTest.java
More file actions
54 lines (49 loc) · 1.77 KB
/
Copy pathCardEditableTest.java
File metadata and controls
54 lines (49 loc) · 1.77 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
52
53
54
package Model;
import com.lob.model.CardEditable;
import com.lob.model.Card;
import org.testng.annotations.*;
import org.testng.Assert;
public class CardEditableTest {
@DataProvider (name = "card-editable-data-provider")
public Object[][] cardEditableDpMethod() {
return new Object[][] {
{"front", "fake front"},
{"back", "fake back"},
{"description", "fake description"},
{"size", CardEditable.SizeEnum._3_375X2_125},
{"size", CardEditable.SizeEnum._2_125X3_375},
};
}
@Test(enabled=true, dataProvider = "card-editable-data-provider")
public void cardEditableTestWithProvidedValue(String prop, Object val) throws Exception {
CardEditable rec = new CardEditable();
switch (prop) {
case "front": {
String castedVal = (String)val;
rec.setFront(castedVal);
Assert.assertEquals(rec.getFront(), castedVal);
break;
}
case "back": {
String castedVal = (String)val;
rec.setBack(castedVal);
Assert.assertEquals(rec.getBack(), castedVal);
break;
}
case "description": {
String castedVal = (String)val;
rec.setDescription(castedVal);
Assert.assertEquals(rec.getDescription(), castedVal);
break;
}
case "size": {
CardEditable.SizeEnum castedVal = (CardEditable.SizeEnum)val;
rec.setSize(castedVal);
Assert.assertEquals(rec.getSize(), castedVal);
break;
}
default:
throw new Exception("Wrong prop name: " + prop);
}
}
}