Tiny implements Serializable { public void setText(String text) { StringPrecondition.checkStringArgument(text, MAX_LENGTH); this.text = text; }  @Column(name="tiny_text", length = MAX_LENGTH) String getText(); void setText(String text); static final int MAX_LENGTH; }
@Test(expected = IllegalArgumentException.class) public void testSetTextTooBig() { Tiny tiny = new Tiny(); tiny.setText("12345678902234567890323456789042345678905234567890623456789072345678908234567890923456789002345678901234567890"); assertThat(true, is(false)); }