Guest User

Untitled

a guest
Dec 13th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. //
  2. // CHALLENGE (work in pairs):
  3. // Move from f(o) -> o.f() and sure that the code is CQS compliant.
  4. //
  5.  
  6.  
  7. // 1
  8. class CsvParser<T extends Lines> {
  9. Collection<T> parse(File location) {
  10. }
  11. }
  12.  
  13.  
  14. // 2
  15. interface Pinger {
  16. void sendPing();
  17. }
  18.  
  19.  
  20. // 3
  21. interface TcpSocket {
  22. Stream<Byte> startReading();
  23. }
  24.  
  25.  
  26.  
  27.  
  28.  
  29. // 4
  30. // Iovation - a company that maintains a blacklist of email addresses and corresponding IPs
  31. interface IovationService {
  32. boolean shouldBlockWebsiteVisitor(IovationClientRequest request);
  33. }
  34.  
  35. interface IovationClientRequest {
  36. String getEmail();
  37. String getIpAddress();
  38. }
  39.  
  40.  
  41.  
  42.  
  43. // 5
  44. interface AnonymousUserAuthenticator {
  45. Token authenticate(String username, String password) throws WrongAuthenticationCredentialsProvided;
  46. }
  47.  
  48.  
  49.  
  50.  
  51. // 6
  52. interface Test {
  53. interface TestResult {
  54. void print();
  55. }
  56. boolean over();
  57. Collection<TestResult> listTestResults();
  58. }
  59.  
  60. if (test.over()) {
  61. for (TestResult tr : test.listTestResults()) {
  62. // pretty printing
  63. tr.print();
  64. }
  65. }
  66.  
  67.  
  68. // 7
  69. boolean destroyButtonAvailable =
  70. widgets
  71. .stream()
  72. .filter(Widget::isButton)
  73. .filter(button -> button.label().equals("Destroy The World"))
  74. .isPresent();
  75.  
  76.  
  77. // 8
  78. interface File {
  79. void openAndThrowIfNotFound();
  80. }
Add Comment
Please, Sign In to add comment