Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/com/github/javafaker/Color.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ public String hex() {

public String hex(boolean includeHashSign) {
String hexString = faker.random().hex(6);
if(includeHashSign)
if(includeHashSign) {
return "#" + hexString;
}
return hexString;
}
}
4 changes: 3 additions & 1 deletion src/main/java/com/github/javafaker/Internet.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public String avatar() {
*/
public String image() {
String[] dimension = StringUtils.split(faker.fakeValuesService().resolve("internet.image_dimension", this, faker), 'x');
if (dimension.length == 0) return "";
if (dimension.length == 0) {
return "";
}
return image(
Integer.valueOf(StringUtils.trim(dimension[0])), Integer.valueOf(StringUtils.trim(dimension[1])),
faker.bool().bool(), null);
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/github/javafaker/Number.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public int randomDigitNotZero() {
* @see Number#numberBetween(long, long)
*/
public int numberBetween(int min, int max) {
if (min == max) return min;
if (min == max){
return min;x
}

int value = decimalBetween(min,max).setScale(0, BigDecimal.ROUND_HALF_DOWN).intValue();
return value == max ? value - 1 : value;
Expand All @@ -42,7 +44,9 @@ public int numberBetween(int min, int max) {
* @param max exclusive (unless min == max)
*/
public long numberBetween(long min, long max) {
if (min == max) return min;
if (min == max) {
return min;
}

long value = decimalBetween(min, max).setScale(0, BigDecimal.ROUND_HALF_DOWN).longValue();
return value == max ? value - 1 : value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ public String fetchString(String key) {
@SuppressWarnings("unchecked")
public String safeFetch(String key, String defaultIfNull) {
Object o = fetchObject(key);
if (o == null) return defaultIfNull;
if (o == null) {
return defaultIfNull;
}
if (o instanceof List) {
List<String> values = (List<String>) o;
if (values.size() == 0) {
Expand Down