### Question:
UserData { public static UserData parse(String userData) { if (!StringUtils.isBlank(userData)) { StringTokenizer stringTokenizer = new StringTokenizer(userData, "\n"); while (stringTokenizer.hasMoreTokens()) { String line = stringTokenizer.nextToken(); int envStartIdx = line.indexOf(ENVIRONMENT_TEXT); if (envStartIdx >= 0) { String env = line.substring(envStartIdx + ENVIRONMENT_TEXT.length()); return new UserData(StringUtils.trimToNull(env)); } } } throw new BootstrapException("Found no environment data in user-data " + userData); } UserData(String environment); static UserData parse(String userData); String getEnvironment(); String toString(); static final String ENVIRONMENT_TEXT; public String environment; }### Answer:
@Test(expected = BootstrapException.class) public void nullUserData(){ UserData.parse(null); }
@Test(expected = BootstrapException.class) public void emptyUserData(){ UserData.parse(" "); }
@Test(expected = BootstrapException.class) public void noEnvironment(){ UserData.parse("FOO=BAR"); }