File tree Expand file tree Collapse file tree
main/java/com/gooddata/executeafm/result
test/groovy/com/gooddata/executeafm/result Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ public class ResultTotalHeaderItem extends ResultHeaderItem {
2424
2525 private final String type ;
2626
27+ /**
28+ * Creates new instance of given total type, type is used for the name as well
29+ * @param type total type
30+ */
31+ public ResultTotalHeaderItem (final String type ) {
32+ this (type , type );
33+ }
34+
35+ /**
36+ * Creates new instance of given total type, type is used for the name as well
37+ * @param type total type
38+ */
39+ public ResultTotalHeaderItem (final Total type ) {
40+ this (notNull (type , "type" ).toString ());
41+ }
42+
2743 /**
2844 * Creates new instance of given header name and total type
2945 * @param name header name
Original file line number Diff line number Diff line change @@ -32,4 +32,16 @@ class ResultTotalHeaderItemTest extends Specification {
3232 item. name == ' Some total'
3333 item. type == ' avg'
3434 }
35+
36+ def " should create from type only" () {
37+ expect :
38+ with(new ResultTotalHeaderItem (' avg' )) {
39+ name == ' avg'
40+ type == ' avg'
41+ }
42+ with(new ResultTotalHeaderItem (Total . SUM )) {
43+ name == ' sum'
44+ type == ' sum'
45+ }
46+ }
3547}
You can’t perform that action at this time.
0 commit comments