1 package com.atlassian.sal.core.search;
2
3 import com.atlassian.sal.api.message.Message;
4 import com.atlassian.sal.api.search.ResourceType;
5 import com.atlassian.sal.api.search.SearchMatch;
6 import com.atlassian.sal.api.search.SearchResults;
7 import com.atlassian.sal.core.message.DefaultMessage;
8
9 import junit.framework.TestCase;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14
15
16 public class TestSearchResults extends TestCase
17 {
18
19 public void testErrorsAndMatchesIsNotModifiablel()
20 {
21 SearchResults searchResults = new SearchResults(new ArrayList<Message>());
22 List<Message> errors = searchResults.getErrors();
23 try
24 {
25 errors.add(new DefaultMessage("stuff"));
26 fail();
27 }
28 catch (UnsupportedOperationException e)
29 {
30
31 }
32 List<SearchMatch> matches = searchResults.getMatches();
33 try
34 {
35 matches.add(new SearchMatch()
36 {
37
38 public String getUrl()
39 {
40 return null;
41 }
42
43 public String getTitle()
44 {
45 return null;
46 }
47
48 public String getExcerpt()
49 {
50 return null;
51 }
52
53 public ResourceType getResourceType()
54 {
55 return null;
56 }
57 });
58 fail();
59 }
60 catch (UnsupportedOperationException e)
61 {
62
63 }
64 }
65
66 }