@Test public void generateBoundary_allZeros() throws Exception { Random random = createRandom(0); BoundaryGenerator boundaryGenerator = new BoundaryGenerator(random); String result = boundaryGenerator.generateBoundary(); assertEquals("----000000000000000000000000000000", 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();  }