• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.junit.experimental.theories;
2 
3 public abstract class PotentialAssignment {
4 	public static class CouldNotGenerateValueException extends Exception {
5 		private static final long serialVersionUID= 1L;
6 	}
7 
forValue(final String name, final Object value)8 	public static PotentialAssignment forValue(final String name, final Object value) {
9 		return new PotentialAssignment() {
10 			@Override
11 			public Object getValue() throws CouldNotGenerateValueException {
12 				return value;
13 			}
14 
15 			@Override
16 			public String toString() {
17 				return String.format("[%s]", value);
18 			}
19 
20 			@Override
21 			public String getDescription()
22 					throws CouldNotGenerateValueException {
23 				return name;
24 			}
25 		};
26 	}
27 
28 	public abstract Object getValue() throws CouldNotGenerateValueException;
29 
30 	public abstract String getDescription() throws CouldNotGenerateValueException;
31 }
32