}
@Test
public void testFlags() throws Exception {
SelfEquals checker;
CompilationTestHelper compilationHelper;
// Both checks off.
try {
new SelfEquals(false, false);
fail();
} catch (IllegalArgumentException e) {
// Expected to get an exception.
}
// Both checks on.
checker = new SelfEquals(true, true);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileFailsWithMessages(positiveCase1);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileFailsWithMessages(positiveCase2);
// Guava on, Eauals off.
checker = new SelfEquals(true, false);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileFailsWithMessages(positiveCase1);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileSucceeds(positiveCase2);
// Equals on, Guava off.
checker = new SelfEquals(false, true);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileSucceeds(positiveCase1);
compilationHelper = CompilationTestHelper.newInstance(checker);
compilationHelper.assertCompileFailsWithMessages(positiveCase2);
}