File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -29,4 +29,11 @@ private void createFileIfDoesntExist(Path path) {
2929 fileOperator .createFileAtPath (path );
3030 } catch (IOException e ) {}
3131 }
32+
33+ public byte [] readLog () {
34+ try {
35+ return fileOperator .readContents (logPath );
36+ } catch (IOException e ) {}
37+ return null ;
38+ }
3239}
Original file line number Diff line number Diff line change @@ -40,4 +40,15 @@ public void onLogCallsFileOperatorAppendWithPathAndPayload() throws Exception {
4040
4141 assertEquals ("POST example\r \n HEAD example\r \n " , new String (readAllBytes (logPath )));
4242 }
43+
44+ @ Test
45+ public void readsLog () throws Exception {
46+ Path logPath = Paths .get (tempDir ().toString (), "logs" );
47+ Logger logger = new Logger (logPath , new FileOperator ());
48+
49+ logger .log ("POST example" );
50+ logger .log ("HEAD example" );
51+
52+ assertEquals ("POST example\r \n HEAD example\r \n " , new String (logger .readLog ()));
53+ }
4354}
You can’t perform that action at this time.
0 commit comments