RandomUnicodeStringFactoryImpl implements RandomStringFactory { @Override public String getString(Font font, int length) { throw new UnsupportedOperationException("getString(Font font, int length) method is not implemented yet"); } RandomUnicodeStringFactoryImpl(int[] printableCodePointArray); @Override String getString(Font font, int length); @Override String getOneCharString(Font font); @Override String getString(int length); @Override String getOneCharString(); static final int MAX_LENGTH; static final int ONE; }
@Test(expected = IllegalArgumentException.class) public void testGetStringMoreThanMaxLengthThrowsExceptionNoFont() throws Exception { rsf.getString(RandomUnicodeStringFactoryImpl.MAX_LENGTH + 1); }
@Test(expected = IllegalArgumentException.class) public void testGetStringZeroLengthThrowsExceptionNoFont() throws Exception { rsf.getString(0); }
@Test public void testGetStringNoFont() throws Exception { assertNotNull(rsf.getString(100)); assertNotNull(rsf.getString(1)); }
@Test public void testCodePointsWithinMinMax() throws Exception { String s = rsf.getString(RandomUnicodeStringFactoryImpl.MAX_LENGTH); for (int i = 0; i < RandomUnicodeStringFactoryImpl.MAX_LENGTH; i++) { assertTrue(s.charAt(i) >= 1 && s.charAt(i) <= 100); } }
@Test(expected = UnsupportedOperationException.class) public void testGetStringFontArgument() throws Exception { rsf.getString(null, 10); }