1 package org.displaytag.util; 2 3 import java.util.ArrayList ; 4 5 import junit.framework.TestCase; 6 7 import org.apache.commons.lang.ClassUtils; 8 import org.displaytag.model.Cell; 9 import org.displaytag.model.Column; 10 import org.displaytag.model.HeaderCell; 11 import org.displaytag.model.Row; 12 import org.displaytag.model.TableModel; 13 import org.displaytag.pagination.NumberedPage; 14 import org.displaytag.pagination.Pagination; 15 import org.displaytag.pagination.SmartListHelper; 16 import org.displaytag.properties.TableProperties; 17 import org.displaytag.tags.ColumnTag; 18 19 20 26 public class ToStringTest extends TestCase 27 { 28 29 32 public String getName() 33 { 34 return getClass().getName() + "." + super.getName(); 35 } 36 37 42 private void checkToString(Object object) 43 { 44 String toString = object.toString(); 45 assertTrue(toString.startsWith(ClassUtils.getShortClassName(object, null))); 46 } 47 48 51 public void testSmartListHelper() 52 { 53 checkToString(new SmartListHelper(new ArrayList (), 100, 10, TableProperties.getInstance(null), false)); 54 } 55 56 59 public void testNumberedPage() 60 { 61 checkToString(new NumberedPage(1, false)); 62 } 63 64 67 public void testPagination() 68 { 69 checkToString(new Pagination(null, null)); 70 } 71 72 75 public void testCell() 76 { 77 checkToString(new Cell(null)); 78 } 79 80 83 public void testHeaderCell() 84 { 85 checkToString(new HeaderCell()); 86 } 87 88 91 public void testColumn() 92 { 93 checkToString(new Column(new HeaderCell(), null, null)); 94 } 95 96 99 public void testRow() 100 { 101 checkToString(new Row(null, 0)); 102 } 103 104 107 public void testTableModel() 108 { 109 checkToString(new TableModel(null, null, null)); 110 } 111 112 115 public void testColumnTag() 116 { 117 checkToString(new ColumnTag()); 118 } 119 120 } 121 | Popular Tags |