001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.classic.corpusTest; 015 016import static org.junit.Assert.*; 017 018import java.io.BufferedReader; 019import java.io.IOException; 020import java.io.StringReader; 021import java.util.List; 022 023import org.junit.Test; 024 025import ch.qos.logback.classic.corpus.TextFileUtil; 026 027public class TextFileUtilTest { 028 029 @Test 030 public void smoke() throws IOException { 031 String s = "When on board H.M.S. 'Beagle,' as naturalist, I was much struck with\r\n" 032 + "certain facts in the distribution of the inhabitants of South America,\r\n" 033 + "and in the geological relations of the present to the past inhabitants\r\n" + "of that continent."; 034 035 StringReader sr = new StringReader(s); 036 BufferedReader br = new BufferedReader(sr); 037 List<String> wordList = TextFileUtil.toWords(br); 038 assertEquals(38, wordList.size()); 039 assertEquals("When", wordList.get(0)); 040 assertEquals("'Beagle,'", wordList.get(4)); 041 assertEquals("of", wordList.get(17)); 042 043 } 044}