tests: CodeCompletionResult - get(name), get(kind,name) methods added
diff --git a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
index 93c53f1..d81dd94 100644
--- a/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
+++ b/core/tests/org.eclipse.dltk.core.tests/src/org/eclipse/dltk/core/tests/CodeAssistUtil.java
@@ -188,6 +188,10 @@
 		return (IModuleSource) module.module;
 	}
 
+	/**
+	 * Value class for completion proposals returned by
+	 * {@link CodeAssistUtil#codeComplete()} methods.
+	 */
 	public class CodeCompletionResult {
 
 		private final List<CompletionProposal> proposals;
@@ -248,6 +252,37 @@
 						.toString());
 			}
 		}
+
+		/**
+		 * Finds the proposal with the specified name or throws exception if no
+		 * such proposal found.
+		 */
+		public CompletionProposal get(String name)
+				throws IllegalArgumentException {
+			for (CompletionProposal proposal : proposals) {
+				if (name.equals(proposal.getName())) {
+					return proposal;
+				}
+			}
+			throw new IllegalArgumentException(NLS.bind(
+					"\"{0}\" completion proposal not found", name));
+		}
+
+		/**
+		 * Finds the proposal with the specified kind and name or throws
+		 * exception if no such proposal found.
+		 */
+		public CompletionProposal get(int kind, String name)
+				throws IllegalArgumentException {
+			for (CompletionProposal proposal : proposals) {
+				if (kind == proposal.getKind()
+						&& name.equals(proposal.getName())) {
+					return proposal;
+				}
+			}
+			throw new IllegalArgumentException(NLS.bind(
+					"\"{0}:{1}\" completion proposal not found", kind, name));
+		}
 	}
 
 	public CodeCompletionResult codeComplete(ICompletionEngine engine) {