refine AbstractFormatter.java
add mockito
add tests