-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to sentAt field to be null #345
Conversation
…date on sentAt field or use a null value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes does not address the issue, since Batch.create()
is only used internally to create a batch.
you'll need to do the following:
- in
Message
add a new nullable fieldsentAt
- in
MessageBuilder
add a new fieldsentAt
and make changes accordingly. you can takeuserId
as an example for what needs to be done - in
MessageBuilder.realBuild
add a new parametersentAt
and make changes accordingly. - discard all your changes in
Batch
. increate
method do the following
if any message in batch has `sentAt` not null
use that value to create batch
otherwise
use `new Date()` to create batch
now the users can use builder.sentAt()
to modify the value
} | ||
|
||
public abstract List<Message> batch(); | ||
|
||
@Nullable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to be nullable here
@@ -26,6 +28,22 @@ public void create(TestUtils.MessageBuilderFactory factory) { | |||
assertThat(batch.context()).isEqualTo(context); | |||
} | |||
|
|||
@Test | |||
public void createWithSentAt(TestUtils.MessageBuilderFactory factory) throws ParseException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to have another test with messages has sentAt
as nulls, so we have both paths covered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
Override method create on Batch class to lend to user define his own date on sentAt field or use a null value.
Issue #340