Injecting Clock in Java
Upcoming SlideShare
Loading in...5
×
 

Injecting Clock in Java

on

  • 235 views

A lightning presentation on using injected Clock instances from JSR-310 (Java 8's java.time.*).

A lightning presentation on using injected Clock instances from JSR-310 (Java 8's java.time.*).

Statistics

Views

Total Views
235
Slideshare-icon Views on SlideShare
233
Embed Views
2

Actions

Likes
1
Downloads
2
Comments
0

2 Embeds 2

https://twitter.com 1
http://www.slideee.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Injecting Clock in Java Injecting Clock in Java Presentation Transcript

    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock is about
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock is about
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock is about
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock is about
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Injecting Clock is about
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. Why do we care? •  You can write tests that do not depend on when they are run – Ward against Daylight Savings transition •  You can write tests for specific timing conditions – Test these “after NN hours” rules •  Offers another way of controlling timezone to be used by some code – More selective than default time zone
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. How does it work?
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. How does it work?
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. How does it work?
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. How does it work?
    • © 2014 RichRelevance, Inc. All Rights Reserved. Confidential. How do I test? •  Inject a clock explicitly – Mocked – From a Clock factory