Skip to content

Commit 11fd633

Browse files
committed
Test Case for the PR 150
1 parent 3ca5643 commit 11fd633

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

splunk/src/main/java/com/splunk/Service.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,16 @@ public SavedSearchCollection getSavedSearches(Args args) {
10131013
return new SavedSearchCollection(this, args);
10141014
}
10151015

1016+
/**
1017+
* Returns a Saved Search by the provided title key.
1018+
*
1019+
* @param title The title for a job.
1020+
* @return A SavedSearch.
1021+
*/
1022+
public SavedSearch getSavedSearch(String title) {
1023+
return new SavedSearch(this, JobCollection.REST_PATH + "/" + title);
1024+
}
1025+
10161026
/**
10171027
* Returns service configuration information for an instance of Splunk.
10181028
*

splunk/src/test/java/com/splunk/SavedSearchTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,15 @@ public void testScheduled() {
314314

315315
savedSearch.remove();
316316
}
317-
317+
318+
@Test
319+
public void testGetSavedSearchByTitle(){
320+
try{
321+
SavedSearch fetchedSavedSearch = this.savedSearches.getService().getSavedSearch(savedSearchName);
322+
Assert.assertEquals(fetchedSavedSearch.getName(),savedSearch.getName());
323+
}catch (Exception e) { }
324+
}
325+
318326
@Test
319327
public void testCreateWithNoSearch() {
320328
try {

0 commit comments

Comments
 (0)