Skip to content

Commit

Permalink
#440 updated solution
Browse files Browse the repository at this point in the history
  • Loading branch information
albertotn committed Oct 6, 2020
1 parent 00e1e19 commit d71d6e9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ private StringBuilder createAndDescription(final StringBuilder builder, final Li
if (!builder.toString().startsWith(bundle.getString("at"))) {
builder.append(String.format(" %s ", bundle.getString("and")));
} else {
builder.append(" ");
if (builder.toString().equals(bundle.getString("at"))) {
builder.insert(0, "Every second ");
} else {
builder.append(" ");
}
}
builder.append(describe(expressions.get(expressions.size() - 1), true));
return builder;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/cronutils/Issue440Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public void setUp() {
public void testCase1() {
CronDescriptor descriptor = CronDescriptor.instance(Locale.UK);
String description = descriptor.describe(parser.parse("* 2,1/31 * * * ?"));
assertTrue(description.equalsIgnoreCase("at 2 minutes every 31 minutes"));
assertTrue(description.equalsIgnoreCase("Every second at 2 minutes and every 31 minutes"));
}
}

0 comments on commit d71d6e9

Please sign in to comment.