Skip to content

Commit 24560c6

Browse files
committed
Changed type of goalId from string to integer
1 parent 99d1da0 commit 24560c6

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/com/ge/corporate/piwik/tracking/PiwikRequest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,15 @@ public void setDownloadUrl(URL downloadUrl){
436436
* cart update or an ecommerce order.
437437
*/
438438
public void enableEcommerce(){
439-
setGoalId("0");
439+
setGoalId(0);
440440
}
441441

442442
/**
443443
* Verifies that Ecommerce has been enabled for the request. Will throw an
444444
* {@link IllegalStateException} if not.
445445
*/
446446
public void verifyEcommerceEnabled(){
447-
if (!"0".equals(getGoalId())){
447+
if (getGoalId() == null || getGoalId() != 0){
448448
throw new IllegalStateException("GoalId must be \"0\". Try calling enableEcommerce first before calling this method.");
449449
}
450450
}
@@ -680,16 +680,16 @@ public void setEventValue(Number eventValue){
680680
* Get the goal id
681681
* @return the goal id
682682
*/
683-
public String getGoalId(){
684-
return (String)getParameter(GOAL_ID);
683+
public Integer getGoalId(){
684+
return (Integer)getParameter(GOAL_ID);
685685
}
686686

687687
/**
688688
* Set the goal id. If specified, the tracking request will trigger a
689689
* conversion for the goal of the website being tracked with this id.
690690
* @param goalId the goal id to set
691691
*/
692-
public void setGoalId(String goalId){
692+
public void setGoalId(Integer goalId){
693693
setParameter(GOAL_ID, goalId);
694694
}
695695

@@ -1052,8 +1052,8 @@ public String getSearchCategory(){
10521052
}
10531053

10541054
/**
1055-
* When <strong>Query</strong> is specified, you can optionally specify a search category
1056-
* with this parameter.
1055+
* Specify a search category with this parameter. SearchQuery must first be
1056+
* set.
10571057
* @param searchCategory the search category to set
10581058
*/
10591059
public void setSearchCategory(String searchCategory){
@@ -1089,10 +1089,10 @@ public Long getSearchResultsCount(){
10891089
}
10901090

10911091
/**
1092-
* When <strong>Query</strong> is specified, we also recommend to set the
1092+
* We recommend to set the
10931093
* search count to the number of search results displayed on the results page.
10941094
* When keywords are tracked with {@code Search Results Count=0} they will appear in
1095-
* the "No Result Search Keyword" report.
1095+
* the "No Result Search Keyword" report. SearchQuery must first be set.
10961096
* @param searchResultsCount the search results count to set
10971097
*/
10981098
public void setSearchResultsCount(Long searchResultsCount){

test/com/ge/corporate/piwik/tracking/PiwikRequestTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public void testDownloadUrl() throws Exception{
263263
@Test
264264
public void testEnableEcommerce(){
265265
request.enableEcommerce();
266-
assertEquals("0", request.getGoalId());
266+
assertEquals(new Integer(0), request.getGoalId());
267267
}
268268

269269
/**
@@ -548,16 +548,16 @@ public void testEventName(){
548548
@Test
549549
public void testEventValue(){
550550
request.setEventValue(1);
551-
assertEquals(new Integer(1), request.getEventValue());
551+
assertEquals(1, request.getEventValue());
552552
}
553553

554554
/**
555555
* Test of getGoalId method, of class PiwikRequest.
556556
*/
557557
@Test
558558
public void testGoalId(){
559-
request.setGoalId("id");
560-
assertEquals("id", request.getGoalId());
559+
request.setGoalId(1);
560+
assertEquals(new Integer(1), request.getGoalId());
561561
}
562562

563563
/**
@@ -576,7 +576,7 @@ public void testGoalRevenueT(){
576576
}
577577
@Test
578578
public void testGoalRevenue(){
579-
request.setGoalId("id");
579+
request.setGoalId(1);
580580
request.setGoalRevenue(20.0);
581581

582582
assertEquals(new Double(20.0), request.getGoalRevenue());

0 commit comments

Comments
 (0)