@@ -201,47 +201,50 @@ private ReadAsserter(File file) {
201201 this .file = file ;
202202 }
203203
204- public void hasContent (String expected ) {
205- hasContent (expected , StandardCharsets .UTF_8 );
204+ public ReadAsserter hasContent (String expected ) {
205+ return hasContent (expected , StandardCharsets .UTF_8 );
206206 }
207207
208- public void hasNotContent (String notExpected ) {
209- notHasContent (notExpected , StandardCharsets .UTF_8 );
208+ public ReadAsserter hasNotContent (String notExpected ) {
209+ return notHasContent (notExpected , StandardCharsets .UTF_8 );
210210 }
211211
212- public void hasContent (String expected , Charset charset ) {
212+ public ReadAsserter hasContent (String expected , Charset charset ) {
213213 assertThat (file ).usingCharset (charset ).hasContent (expected );
214+ return this ;
214215 }
215216
216- public void notHasContent (String notExpected , Charset charset ) {
217+ public ReadAsserter notHasContent (String notExpected , Charset charset ) {
217218 assertThat (file ).usingCharset (charset ).content ().isNotEqualTo (notExpected );
219+ return this ;
218220 }
219221
220- public void hasLines (String ... lines ) {
221- hasContent (String .join ("\n " , Arrays .asList (lines )));
222+ public ReadAsserter hasLines (String ... lines ) {
223+ return hasContent (String .join ("\n " , Arrays .asList (lines )));
222224 }
223225
224- public void sameAsResource (String resource ) {
225- hasContent (getTestResource (resource ));
226+ public ReadAsserter sameAsResource (String resource ) {
227+ return hasContent (getTestResource (resource ));
226228 }
227229
228- public void notSameSasResource (String resource ) {
229- hasNotContent (getTestResource (resource ));
230+ public ReadAsserter notSameSasResource (String resource ) {
231+ return hasNotContent (getTestResource (resource ));
230232 }
231233
232- public void matches (Consumer <AbstractCharSequenceAssert <?, String >> conditions ) throws IOException {
234+ public ReadAsserter matches (Consumer <AbstractCharSequenceAssert <?, String >> conditions ) throws IOException {
233235 String content = new String (Files .readAllBytes (file .toPath ()), StandardCharsets .UTF_8 );
234236 conditions .accept (assertThat (content ));
237+ return this ;
235238 }
236239
237- public void sameAsFile (File otherFile ) throws IOException {
240+ public ReadAsserter sameAsFile (File otherFile ) throws IOException {
238241 String otherFileContent = Files .readString (otherFile .toPath ());
239- hasContent (otherFileContent , StandardCharsets .UTF_8 );
242+ return hasContent (otherFileContent , StandardCharsets .UTF_8 );
240243 }
241244
242- public void notSameAsFile (File otherFile ) throws IOException {
245+ public ReadAsserter notSameAsFile (File otherFile ) throws IOException {
243246 String otherFileContent = Files .readString (otherFile .toPath ());
244- notHasContent (otherFileContent , StandardCharsets .UTF_8 );
247+ return notHasContent (otherFileContent , StandardCharsets .UTF_8 );
245248 }
246249 }
247250
0 commit comments