@Test public void generateBoundary() throws Exception { Random random = createRandom(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 35); BoundaryGenerator boundaryGenerator = new BoundaryGenerator(random); String result = boundaryGenerator.generateBoundary(); assertEquals("----0123456789ABCDEFGHIJKLMNOPQRSZ", result); }
public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting  BoundaryGenerator(Random random); }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting  BoundaryGenerator(Random random); static BoundaryGenerator getInstance(); String generateBoundary(); }
BoundaryGenerator { public String generateBoundary() { StringBuilder builder = new StringBuilder(4 + BOUNDARY_CHARACTER_COUNT); builder.append("----"); for (int i = 0; i < BOUNDARY_CHARACTER_COUNT; i++) { builder.append(BASE36_MAP[random.nextInt(36)]); } return builder.toString(); } @VisibleForTesting  BoundaryGenerator(Random random); static BoundaryGenerator getInstance(); String generateBoundary();  }