Skip to content

Commit f8538aa

Browse files
committed
readme updated
1 parent cbaa3ea commit f8538aa

2 files changed

Lines changed: 25 additions & 16 deletions

File tree

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,22 @@ Now I have the below dependencies in my pom.xml
5050
</dependency>
5151
```
5252
So when I call
53-
```javascript
53+
```java
5454
LogFactory.getLogger(LogFactory.class).info("LOCALIZED_MSG", "Kiswani");
55-
output:
55+
56+
Output:
57+
5658
Nov 22, 2016 6:54:07 PM io.github.rhkiswani.javaff.log.Slf4jLog info
5759
INFO: this is localized msg from messages_en.properties thanks for Mr Kiswani
5860
```
5961

6062
When I remove the dependencies from the pom.xml and run the same code I will get
6163

62-
```javascript
64+
```java
6365
LogFactory.getLogger(LogFactory.class).info("LOCALIZED_MSG", "Kiswani");
64-
output:
66+
67+
Output:
68+
6569
Nov 22, 2016 7:00:15 PM io.github.rhkiswani.javaff.log.DefaultLog info
6670
INFO: this is localized msg from messages_en.properties thanks for Mr Kiswani
6771
```
@@ -80,15 +84,15 @@ When I remove the dependencies from the pom.xml and run the same code I will get
8084
public class TestMain {
8185

8286
public static void main(String[] args) {
83-
//Any class is instance of ConsoleException will be handled here
87+
//Any instance of ConsoleException will be handled here
8488
ExceptionHandlersFactory.instance().add(ConsoleException.class, new ExceptionHandler() {
8589
@Override
8690
public void handle(Throwable t) {
8791
System.out.println("ConsoleException handler");
8892
}
8993
});
9094

91-
//Any class is instance of MailException will be handled here
95+
//Any instance of MailException will be handled here
9296
ExceptionHandlersFactory.instance().add(MailException.class, new ExceptionHandler() {
9397
@Override
9498
public void handle(Throwable t) {
@@ -141,11 +145,15 @@ When I remove the dependencies from the pom.xml and run the same code I will get
141145

142146
```java
143147
LogFactory.getLogger(LogFactory.class).info("LOCALIZED_MSG", "Kiswani");
144-
output : INFO: this is localized msg from messages_en.properties thanks for Mr Kiswani
148+
149+
Output :
150+
INFO: this is localized msg from messages_en.properties thanks for Mr Kiswani
145151
```
146152

147153
```java
148154
LogFactory.getLogger(LogFactory.class).info("normal msg num {0} date {1}", Integer.MAX_VALUE, new Date());
155+
156+
Output:
149157
INFO: normal msg num 2,147,483,647 date 11/22/16 6:06 PM
150158
```
151159

@@ -157,6 +165,7 @@ When I remove the dependencies from the pom.xml and run the same code I will get
157165
System.out.println(FormatUtil.format(new Date(), "yyyy-MM-dd"));
158166
System.out.println(FormatUtil.format(Integer.MAX_VALUE));
159167

168+
Output:
160169
Mr Mohamed Kiswani
161170
11/22/16 6:16 PM
162171
2016-11-22
@@ -168,6 +177,7 @@ When I remove the dependencies from the pom.xml and run the same code I will get
168177
System.out.println(JsonHandlerFactory.getJsonHandler(TestMain.class).toJson(new Employee(1000)));
169178
output : {"id":0,"name":null,"empId":1000}
170179
```
180+
171181
```java
172182
System.out.println(JsonHandlerFactory.getJsonHandler(TestMain.class).fromJson("{\"id\":100,\"name\":null,\"empId\":1000}", Employee.class));
173183
output: Employee[id=100]

src/test/java/io/github/rhkiswani/javaff/exceptions/ExceptionHandlersFactoryTest.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1616
public class ExceptionHandlersFactoryTest {
1717

18+
private String exceptionMsg = "dummyMsg";
1819
private ExceptionHandler exceptionHandler ;
1920

2021
@Before
@@ -52,7 +53,6 @@ public void handle(Throwable t) {
5253

5354
@Test
5455
public void testFactory() throws Exception {
55-
//FIXME it's failing on travis but not local
5656
assertThat(ExceptionHandlersFactory.getExceptionHandler(Throwable.class).getClass()).isEqualTo(DefaultExceptionHandler.class);
5757
ExceptionHandlersFactory.instance().overrideImp(Throwable.class, exceptionHandler);
5858
assertThat(ExceptionHandlersFactory.getExceptionHandler(Throwable.class).getClass()).isEqualTo(TestExceptionHandler.class);
@@ -66,14 +66,6 @@ public void testFactory() throws Exception {
6666
}
6767
}
6868

69-
private class TestExceptionHandler implements ExceptionHandler {
70-
@Override
71-
public void handle(Throwable t) {
72-
t.printStackTrace();
73-
}
74-
};
75-
76-
String exceptionMsg = "dummyMsg";
7769
@Test
7870
public void testSmartException() throws Exception {
7971
try {
@@ -192,4 +184,11 @@ private static class MailException extends RuntimeException{
192184
private static class SubMailException extends MailException {
193185

194186
}
187+
188+
private class TestExceptionHandler implements ExceptionHandler {
189+
@Override
190+
public void handle(Throwable t) {
191+
t.printStackTrace();
192+
}
193+
};
195194
}

0 commit comments

Comments
 (0)