View Javadoc
1   package com.google.code.beanmatchers;
2   
3   import java.util.Random;
4   
5   class ByteGenerator implements ValueGenerator<Byte> {
6   
7     private final Random random;
8   
9     public ByteGenerator(Random random) {
10      this.random = random;
11    }
12  
13    public Byte generate() {
14      byte[] bytes = new byte[1];
15      random.nextBytes(bytes);
16      return bytes[0];
17    }
18  }