You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CacheUpdateExceptionCausesTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.vaadin.v7.tests.server.component.table;
  2. import static org.junit.Assert.assertEquals;
  3. import static org.junit.Assert.assertSame;
  4. import org.junit.Test;
  5. import com.vaadin.v7.ui.Table;
  6. import com.vaadin.v7.ui.Table.CacheUpdateException;
  7. public class CacheUpdateExceptionCausesTest {
  8. @Test
  9. public void testSingleCauseException() {
  10. Table table = new Table();
  11. Throwable[] causes = { new RuntimeException("Broken in one way.") };
  12. CacheUpdateException exception = new CacheUpdateException(table,
  13. "Error during Table cache update.", causes);
  14. assertSame(causes[0], exception.getCause());
  15. assertEquals("Error during Table cache update.",
  16. exception.getMessage());
  17. }
  18. @Test
  19. public void testMultipleCauseException() {
  20. Table table = new Table();
  21. Throwable[] causes = { new RuntimeException("Broken in the first way."),
  22. new RuntimeException("Broken in the second way.") };
  23. CacheUpdateException exception = new CacheUpdateException(table,
  24. "Error during Table cache update.", causes);
  25. assertSame(causes[0], exception.getCause());
  26. assertEquals(
  27. "Error during Table cache update. Additional causes not shown.",
  28. exception.getMessage());
  29. }
  30. }