RandomPointFactory { public static Point getRandomPoint(Rectangle rect) { Point p = getRandomPointWithDistance(rect, new ArrayList<Point>(), 0); return p; } RandomPointFactory();  RandomPointFactory(int xSpacing, int ySpacing); static Point getFirstVChallengePointFromTopInRegion(Rectangle challengeRectangle, int challengeCount); Point getVChallengePointWrtPercentageSizeOfReferenceFont(Rectangle rectangle, Point referencePoint, Font referenceFont, Font nextFont); static Point getFirstHChallengePointFromLeftInRegion(Rectangle challengeRectangle, int challengeCount); Point getHChallengePointWrtPercentageSizeOfReferenceFont(Rectangle rectangle, Point referencePoint, Font referenceFont, Font nextFont); static Point getRandomPoint(Rectangle rect); static Point getRandomPointWithDistance(Rectangle rectangle, List<Point> reference, int distance); static final int DEFAULT_SPACING; static final int MAX_SPACING; }
@Test public void testGetRandomPoint() throws Exception { Point p; for (int i = 0; i < 100; i++) { p = rpf.getRandomPoint(testRectangle); assertTrue(p.getX() <= MAX); assertTrue(p.getY() <= MAX); } }