Merge pull request #632 from andrewgaul/static-block

Throw exceptions in static blocks
This commit is contained in:
Adrian Cole 2012-05-14 10:22:47 -07:00
commit 8e27b180aa
2 changed files with 6 additions and 4 deletions

View File

@ -39,6 +39,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.base.Throwables;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.TypeLiteral;
@ -50,13 +51,13 @@ import com.google.inject.TypeLiteral;
@Test(groups = { "unit" })
public class BindServerToPlainTextStringTest {
public static String CREATED_SERVER;
public static final String CREATED_SERVER;
static {
try {
CREATED_SERVER = Strings2.toStringAndClose(BindServerToPlainTextStringTest.class
.getResourceAsStream("/create_server.txt"));
} catch (IOException e) {
CREATED_SERVER = null;
throw Throwables.propagate(e);
}
}
public static final Server SERVER = new Server.Builder()

View File

@ -40,6 +40,7 @@ import org.testng.annotations.Test;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.base.Throwables;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
@ -52,13 +53,13 @@ import com.google.inject.TypeLiteral;
@Test(groups = { "unit" })
public class BindServerToPlainTextStringTest {
public static String CREATED_SERVER;
public static final String CREATED_SERVER;
static {
try {
CREATED_SERVER = Strings2.toStringAndClose(BindServerToPlainTextStringTest.class
.getResourceAsStream("/create_server.txt"));
} catch (IOException e) {
CREATED_SERVER = null;
throw Throwables.propagate(e);
}
}
public static final Server SERVER = new Server.Builder()