JavaForFun
7 years agoGiving names to my constraints
Gustavo Martin Morcuende [Fri, 23 Dec 2016 19:56:09 +0000 (20:56 +0100)]
Giving names to my constraints

7 years agospring-jpa-persistence, using gradle
Gustavo Martin Morcuende [Fri, 23 Dec 2016 19:54:45 +0000 (20:54 +0100)]
spring-jpa-persistence, using gradle

7 years agoRxJavaCarControllerIntegrationTest, cleaning up imports
Gustavo Martin Morcuende [Sun, 11 Dec 2016 22:45:15 +0000 (23:45 +0100)]
RxJavaCarControllerIntegrationTest, cleaning up imports

7 years agoRemoving time out from RxJavaAdapter
Gustavo Martin Morcuende [Sun, 11 Dec 2016 22:38:54 +0000 (23:38 +0100)]
Removing time out from RxJavaAdapter

IMHO these kinds of time out should be defined by server adminitrators

7 years agoThoughts about Observable (stream), Single (one element), toList() and Spring
Gustavo Martin Morcuende [Sun, 11 Dec 2016 22:06:55 +0000 (23:06 +0100)]
Thoughts about Observable (stream), Single (one element), toList() and Spring

7 years agoSpring can already work with CompletableFuture
Gustavo Martin Morcuende [Sun, 11 Dec 2016 22:04:57 +0000 (23:04 +0100)]
Spring can already work with CompletableFuture

No need of creating my own adapter :)
See: org.springframework.web.servlet.mvc.method.annotation.DeferredResultMethodReturnValueHandler.CompletionStageAdapter

7 years agoUsing Spring 4.3.4.RELEASE
Gustavo Martin Morcuende [Sun, 11 Dec 2016 22:04:34 +0000 (23:04 +0100)]
Using Spring 4.3.4.RELEASE

7 years agoUsing RxJava 2.0
Gustavo Martin Morcuende [Sun, 11 Dec 2016 21:02:00 +0000 (22:02 +0100)]
Using RxJava 2.0

7 years agoRxJavaCarControllerIntegrationTest
Gustavo Martin Morcuende [Sun, 11 Dec 2016 20:29:47 +0000 (21:29 +0100)]
RxJavaCarControllerIntegrationTest

7 years agoUpdate to RxJava 2.0
Gustavo Martin Morcuende [Sun, 11 Dec 2016 20:17:30 +0000 (21:17 +0100)]
Update to RxJava 2.0

7 years agoUsing RxJava 2.0
Gustavo Martin Morcuende [Sun, 11 Dec 2016 20:16:13 +0000 (21:16 +0100)]
Using RxJava 2.0

7 years agoRemoving useless inner interface from Adapters
Gustavo Martin Morcuende [Sun, 11 Dec 2016 18:08:01 +0000 (19:08 +0100)]
Removing useless inner interface from Adapters

7 years agoFixing CallableCarController
Gustavo Martin Morcuende [Sun, 11 Dec 2016 17:51:57 +0000 (18:51 +0100)]
Fixing CallableCarController

7 years agoCarControllerIntegrationTest
Gustavo Martin Morcuende [Sun, 11 Dec 2016 17:51:39 +0000 (18:51 +0100)]
CarControllerIntegrationTest

7 years agoCompletableFutureCarControllerIntegrationTest
Gustavo Martin Morcuende [Sun, 11 Dec 2016 17:51:02 +0000 (18:51 +0100)]
CompletableFutureCarControllerIntegrationTest

7 years agoDeferredResult, exceptions handler
Gustavo Martin Morcuende [Sat, 10 Dec 2016 03:22:35 +0000 (04:22 +0100)]
DeferredResult, exceptions handler

7 years agoRxJava REST example
Gustavo Martin Morcuende [Sat, 10 Dec 2016 01:37:10 +0000 (02:37 +0100)]
RxJava REST example

7 years agoCreating async services relying on sync ones
Gustavo Martin Morcuende [Sat, 10 Dec 2016 00:44:10 +0000 (01:44 +0100)]
Creating async services relying on sync ones

7 years agoNo repeat yourself :)
Gustavo Martin Morcuende [Fri, 9 Dec 2016 23:50:14 +0000 (00:50 +0100)]
No repeat yourself :)

Adapter for DeferredResult <-> CompletableFuture

7 years agoRxJava, using method reference instead of lambdas
Gustavo Martin Morcuende [Thu, 8 Dec 2016 22:19:15 +0000 (23:19 +0100)]
RxJava, using method reference instead of lambdas

7 years agoPlaying with asynchronous requests in Spring
Gustavo Martin Morcuende [Thu, 8 Dec 2016 20:20:57 +0000 (21:20 +0100)]
Playing with asynchronous requests in Spring

Possibilites:
Callable
Deferrable + CompletableFuture
Deferrable + ListenableFutureAdapter
RxJava

7 years agoMore about working with Promises in Java 8
Gustavo Martin Morcuende [Thu, 8 Dec 2016 17:54:19 +0000 (18:54 +0100)]
More about working with Promises in Java 8

7 years agoNOTICE about parallelism and ForkJoinPool
Gustavo Martin Morcuende [Thu, 8 Dec 2016 00:36:38 +0000 (01:36 +0100)]
NOTICE about parallelism and ForkJoinPool

7 years agoHaving fun with CompletableFuture AKA Promise in Java
Gustavo Martin Morcuende [Thu, 8 Dec 2016 00:25:42 +0000 (01:25 +0100)]
Having fun with CompletableFuture AKA Promise in Java

7 years agoTrying to understand ForkJoinPool
Gustavo Martin Morcuende [Tue, 6 Dec 2016 22:24:56 +0000 (23:24 +0100)]
Trying to understand ForkJoinPool

7 years agoDo not forget Thread.currentThread().interrupt()
Gustavo Martin Morcuende [Tue, 6 Dec 2016 16:12:29 +0000 (17:12 +0100)]
Do not forget Thread.currentThread().interrupt()

Also comments because I already forgot the difference between submit(Runnable) and submit(Callable)

7 years agoFixing coverage in Clock.today()
Gustavo Martin Morcuende [Tue, 6 Dec 2016 15:12:20 +0000 (16:12 +0100)]
Fixing coverage in Clock.today()

Ivan Lorenz solution.

7 years agoMerge branch 'master' of https://github.com/gumartinm/JavaForFun
Gustavo Martin Morcuende [Mon, 5 Dec 2016 21:18:14 +0000 (22:18 +0100)]
Merge branch 'master' of https://github.com/gumartinm/JavaForFun

7 years agoClockGus.format(date) renaming method
Gustavo Martin Morcuende [Mon, 5 Dec 2016 08:48:13 +0000 (09:48 +0100)]
ClockGus.format(date) renaming method

7 years agoClockGus.formatted(date) renaming method
Gustavo Martin Morcuende [Mon, 5 Dec 2016 08:48:13 +0000 (09:48 +0100)]
ClockGus.formatted(date) renaming method

7 years agoMerge branch 'master' of https://github.com/gumartinm/JavaForFun
Gustavo Martin Morcuende [Sun, 4 Dec 2016 22:32:32 +0000 (23:32 +0100)]
Merge branch 'master' of https://github.com/gumartinm/JavaForFun

7 years agoFixing coverage in Clock.today()
Gustavo Martin Morcuende [Sun, 4 Dec 2016 22:09:17 +0000 (23:09 +0100)]
Fixing coverage in Clock.today()

My implementation solves the coverage issue (hopefully it is right)

7 years agoHow to configure IDE Eclipse
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:36:27 +0000 (21:36 +0100)]
How to configure IDE Eclipse

7 years agoWe end up writing our application based on the acceptance test
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:35:31 +0000 (21:35 +0100)]
We end up writing our application based on the acceptance test

7 years agoPrintStatementeFeature requires the right values for clock.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:30:50 +0000 (21:30 +0100)]
PrintStatementeFeature requires the right values for clock.

7 years agoBIG WARNING: Clock.today() is not under test!!!!
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:21:43 +0000 (21:21 +0100)]
BIG WARNING: Clock.today() is not under test!!!!

Our tests do not fail even if we return null from there...

7 years agoMaking StatementPrinter and StatementPrinterShould look better
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:11:59 +0000 (21:11 +0100)]
Making StatementPrinter and StatementPrinterShould look better

7 years agoStatementPrinter, test for print method green
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:09:46 +0000 (21:09 +0100)]
StatementPrinter, test for print method green

7 years agoStatementPrinterShould is failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 19:02:02 +0000 (20:02 +0100)]
StatementPrinterShould is failing for the right reasons.

7 years agoThe acceptance test is failing because we need to implement the print method in State...
Gustavo Martin Morcuende [Sun, 4 Dec 2016 18:49:14 +0000 (19:49 +0100)]
The acceptance test is failing because we need to implement the print method in StatementPrinter.

We always write first a test and then the implementation.
In this case we have to create the test called StatementPrinterShould and from
there we can create the implementation for the print method.

7 years agoClock test is green.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 18:32:51 +0000 (19:32 +0100)]
Clock test is green.

Inline as much code as possible (getting ride of variables)
We isolate and control the randomness in our code.
No using spies, instead, we use private classes in our tests.

7 years agoClock test working but we need to control the random part.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:47:15 +0000 (18:47 +0100)]
Clock test working but we need to control the random part.

We need it in order to write tests that will work in any day.

7 years agoRenaming local variables in TransactionRepository
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:36:34 +0000 (18:36 +0100)]
Renaming local variables in TransactionRepository

7 years agoRemoving duplications from TransactionRepositoryShould
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:35:51 +0000 (18:35 +0100)]
Removing duplications from TransactionRepositoryShould

7 years agoNow we have a test for addWithdrawal
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:34:45 +0000 (18:34 +0100)]
Now we have a test for addWithdrawal

7 years agoIt is only left a test for addWithdrawal
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:31:12 +0000 (18:31 +0100)]
It is only left a test for addWithdrawal

7 years agoTests failing for the right reason
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:25:48 +0000 (18:25 +0100)]
Tests failing for the right reason

We need to keep implementing methods.

7 years agoTests are failing for the right reasons
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:13:27 +0000 (18:13 +0100)]
Tests are failing for the right reasons

They throw UnsupportedOperationException because we need the implementations.

7 years agoWe have a green test for AccountShould
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:41:58 +0000 (17:41 +0100)]
We have a green test for AccountShould

But PrintStatementFeature is failing because the acceptance test is using
the real classes, it tells me what has not been implemented :)

7 years agoAccountShould is failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:33:11 +0000 (17:33 +0100)]
AccountShould is failing for the right reasons.

We can now implement the printStatement method.

7 years agoWe have to test the printStatement method in Account
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:21:38 +0000 (17:21 +0100)]
We have to test the printStatement method in Account

7 years agoDelegating the responsability of storing transactions.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:16:15 +0000 (17:16 +0100)]
Delegating the responsability of storing transactions.

TransactionRepository will store transactions.

7 years agoCreating test for Account.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:57:30 +0000 (16:57 +0100)]
Creating test for Account.

Always write first your asserts.

7 years agoNow we have test expecting some result, it is now failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:19:08 +0000 (16:19 +0100)]
Now we have test expecting some result, it is now failing for the right reasons.

We are using the double loop of unit testing:

* First, start with an acceptance test.
* Second, once the acceptance test is failing for the right reason then you
go to the inner loop of TDD (the unit test) we can start unit testing our code.
  Once we have all the classes under unit tests our accpetance test should go green.

7 years agoTest throws UnsupportedOperationException as expected.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:18:39 +0000 (16:18 +0100)]
Test throws UnsupportedOperationException as expected.

You should configure your IDE for throwing UnsupportedOperationException
whenever it automatically creates a method. In this way, when running
our unit tests we are able to find out what is not yet implemented.

7 years agoWe finish writing our test.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:03:32 +0000 (16:03 +0100)]
We finish writing our test.

7 years agoWriting the asserts and the trigger for those asserts.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:59:05 +0000 (15:59 +0100)]
Writing the asserts and the trigger for those asserts.

7 years agoFirst acceptance test
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:46:11 +0000 (15:46 +0100)]
First acceptance test

Use interfaces for representing the external world.

7 years agoAcceptance test, README (constraints)
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:18:13 +0000 (15:18 +0100)]
Acceptance test, README (constraints)

7 years agoRxJava: using flatMap method
Gustavo Martin Morcuende [Fri, 2 Dec 2016 22:44:05 +0000 (23:44 +0100)]
RxJava: using flatMap method

7 years agoDealing with InterruptedException, the right way.
Gustavo Martin Morcuende [Fri, 2 Dec 2016 22:20:14 +0000 (23:20 +0100)]
Dealing with InterruptedException, the right way.

7 years agoClosing fd as it must be done in CustomHTTPClient
Gustavo Martin Morcuende [Fri, 2 Dec 2016 21:18:03 +0000 (22:18 +0100)]
Closing fd as it must be done in CustomHTTPClient

I feel ashame... :(

7 years agoHaving fun with RxJava
Gustavo Martin Morcuende [Fri, 2 Dec 2016 20:58:55 +0000 (21:58 +0100)]
Having fun with RxJava

7 years agoFixing coverage in Clock.today()
Gustavo Martin Morcuende [Sun, 4 Dec 2016 22:09:17 +0000 (23:09 +0100)]
Fixing coverage in Clock.today()

My implementation solves the coverage issue (hopefully it is right)

7 years agoHow to configure IDE Eclipse
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:36:27 +0000 (21:36 +0100)]
How to configure IDE Eclipse

7 years agoWe end up writing our application based on the acceptance test
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:35:31 +0000 (21:35 +0100)]
We end up writing our application based on the acceptance test

7 years agoPrintStatementeFeature requires the right values for clock.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:30:50 +0000 (21:30 +0100)]
PrintStatementeFeature requires the right values for clock.

7 years agoBIG WARNING: Clock.today() is not under test!!!!
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:21:43 +0000 (21:21 +0100)]
BIG WARNING: Clock.today() is not under test!!!!

Our tests do not fail even if we return null from there...

7 years agoMaking StatementPrinter and StatementPrinterShould look better
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:11:59 +0000 (21:11 +0100)]
Making StatementPrinter and StatementPrinterShould look better

7 years agoStatementPrinter, test for print method green
Gustavo Martin Morcuende [Sun, 4 Dec 2016 20:09:46 +0000 (21:09 +0100)]
StatementPrinter, test for print method green

7 years agoStatementPrinterShould is failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 19:02:02 +0000 (20:02 +0100)]
StatementPrinterShould is failing for the right reasons.

7 years agoThe acceptance test is failing because we need to implement the print method in State...
Gustavo Martin Morcuende [Sun, 4 Dec 2016 18:49:14 +0000 (19:49 +0100)]
The acceptance test is failing because we need to implement the print method in StatementPrinter.

We always write first a test and then the implementation.
In this case we have to create the test called StatementPrinterShould and from
there we can create the implementation for the print method.

7 years agoClock test is green.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 18:32:51 +0000 (19:32 +0100)]
Clock test is green.

Inline as much code as possible (getting ride of variables)
We isolate and control the randomness in our code.
No using spies, instead, we use private classes in our tests.

7 years agoClock test working but we need to control the random part.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:47:15 +0000 (18:47 +0100)]
Clock test working but we need to control the random part.

We need it in order to write tests that will work in any day.

7 years agoRenaming local variables in TransactionRepository
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:36:34 +0000 (18:36 +0100)]
Renaming local variables in TransactionRepository

7 years agoRemoving duplications from TransactionRepositoryShould
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:35:51 +0000 (18:35 +0100)]
Removing duplications from TransactionRepositoryShould

7 years agoNow we have a test for addWithdrawal
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:34:45 +0000 (18:34 +0100)]
Now we have a test for addWithdrawal

7 years agoIt is only left a test for addWithdrawal
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:31:12 +0000 (18:31 +0100)]
It is only left a test for addWithdrawal

7 years agoTests failing for the right reason
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:25:48 +0000 (18:25 +0100)]
Tests failing for the right reason

We need to keep implementing methods.

7 years agoTests are failing for the right reasons
Gustavo Martin Morcuende [Sun, 4 Dec 2016 17:13:27 +0000 (18:13 +0100)]
Tests are failing for the right reasons

They throw UnsupportedOperationException because we need the implementations.

7 years agoWe have a green test for AccountShould
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:41:58 +0000 (17:41 +0100)]
We have a green test for AccountShould

But PrintStatementFeature is failing because the acceptance test is using
the real classes, it tells me what has not been implemented :)

7 years agoAccountShould is failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:33:11 +0000 (17:33 +0100)]
AccountShould is failing for the right reasons.

We can now implement the printStatement method.

7 years agoWe have to test the printStatement method in Account
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:21:38 +0000 (17:21 +0100)]
We have to test the printStatement method in Account

7 years agoDelegating the responsability of storing transactions.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 16:16:15 +0000 (17:16 +0100)]
Delegating the responsability of storing transactions.

TransactionRepository will store transactions.

7 years agoCreating test for Account.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:57:30 +0000 (16:57 +0100)]
Creating test for Account.

Always write first your asserts.

7 years agoNow we have test expecting some result, it is now failing for the right reasons.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:19:08 +0000 (16:19 +0100)]
Now we have test expecting some result, it is now failing for the right reasons.

We are using the double loop of unit testing:

* First, start with an acceptance test.
* Second, once the acceptance test is failing for the right reason then you
go to the inner loop of TDD (the unit test) we can start unit testing our code.
  Once we have all the classes under unit tests our accpetance test should go green.

7 years agoTest throws UnsupportedOperationException as expected.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:18:39 +0000 (16:18 +0100)]
Test throws UnsupportedOperationException as expected.

You should configure your IDE for throwing UnsupportedOperationException
whenever it automatically creates a method. In this way, when running
our unit tests we are able to find out what is not yet implemented.

7 years agoWe finish writing our test.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 15:03:32 +0000 (16:03 +0100)]
We finish writing our test.

7 years agoWriting the asserts and the trigger for those asserts.
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:59:05 +0000 (15:59 +0100)]
Writing the asserts and the trigger for those asserts.

7 years agoFirst acceptance test
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:46:11 +0000 (15:46 +0100)]
First acceptance test

Use interfaces for representing the external world.

7 years agoAcceptance test, README (constraints)
Gustavo Martin Morcuende [Sun, 4 Dec 2016 14:18:13 +0000 (15:18 +0100)]
Acceptance test, README (constraints)

7 years agoRxJava: using flatMap method
Gustavo Martin Morcuende [Fri, 2 Dec 2016 22:44:05 +0000 (23:44 +0100)]
RxJava: using flatMap method

7 years agoDealing with InterruptedException, the right way.
Gustavo Martin Morcuende [Fri, 2 Dec 2016 22:20:14 +0000 (23:20 +0100)]
Dealing with InterruptedException, the right way.

7 years agoClosing fd as it must be done in CustomHTTPClient
Gustavo Martin Morcuende [Fri, 2 Dec 2016 21:18:03 +0000 (22:18 +0100)]
Closing fd as it must be done in CustomHTTPClient

I feel ashame... :(

7 years agoMerge branch 'master' of https://github.com/gumartinm/JavaForFun
Gustavo Martin Morcuende [Fri, 2 Dec 2016 21:00:36 +0000 (22:00 +0100)]
Merge branch 'master' of https://github.com/gumartinm/JavaForFun

7 years agoHaving fun with RxJava
Gustavo Martin Morcuende [Fri, 2 Dec 2016 20:58:55 +0000 (21:58 +0100)]
Having fun with RxJava

7 years agoOutside in TDD
Gustavo Martin Morcuende [Sun, 27 Nov 2016 17:43:42 +0000 (18:43 +0100)]
Outside in TDD

https://www.youtube.com/watch?v=XHnuMjah6ps

7 years agoWe will add our exceptions to the enum.
Gustavo Martin Morcuende [Sun, 27 Nov 2016 17:36:51 +0000 (18:36 +0100)]
We will add our exceptions to the enum.

7 years agoTesting IV
Gustavo Martin Morcuende [Sun, 27 Nov 2016 17:27:34 +0000 (18:27 +0100)]
Testing IV

We are in position of testing exceptions like IV.
Exceptions will be added to enum and our algorithm we will keep working.

7 years agoRemoving duplicated loop.
Gustavo Martin Morcuende [Sun, 27 Nov 2016 17:19:23 +0000 (18:19 +0100)]
Removing duplicated loop.

Two loops were doing the same (appending letters)