// Path: src/test/java/com/urbanairship/datacube/tweetcountexample/Tweet.java
// public class Tweet {
//     private static final Pattern hashtagPattern = Pattern.compile("#(\\w+)");
//     private static final Pattern retweetFromPattern = Pattern.compile("RT @(\\w+)");
// 
//     public final DateTime time;
//     public final String username;
//     public final Optional<String> retweetedFrom;
//     public final String text;
//     public final Set<String> hashTags;
// 
//     public Tweet(String fileLine) {
//         String[] tokens = fileLine.split("\\t");
// 
//         time = new DateTime(Date.parse(tokens[1]), DateTimeZone.UTC);
//         username = tokens[2];
//         text = tokens[3];
// 
//         hashTags = new HashSet<String>(0);
//         Matcher hashtagMatcher = hashtagPattern.matcher(text);
//         while (hashtagMatcher.find()) {
//             hashTags.add(hashtagMatcher.group(1));
//         }
// 
//         Matcher retweetMatcher = retweetFromPattern.matcher(text);
//         if (retweetMatcher.find()) {
//             retweetedFrom = Optional.of(retweetMatcher.group(1));
//         } else {
//             retweetedFrom = Optional.absent();
//         }
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder sb = new StringBuilder();
//         sb.append("(username:" + username);
//         sb.append(", time:" + time);
//         sb.append(", retweeted:" + retweetedFrom);
//         sb.append(", text:" + text);
//         sb.append(", hashtags:" + hashTags);
//         sb.append(")");
//         return sb.toString();
//     }
// }


import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import com.urbanairship.datacube.tweetcountexample.Tweet;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.Test;
package com.urbanairship.datacube.tweetcountexample.tests;


public class TweetParseTest {
    @Test
    public void testParsing() {
        String inputLine = "35720274552823808	Thu, 10 Feb 2011 15:22:31 +0000	iran88	RT @TehranBureau: As #Karroubi placed under house arrest after #25Bahman rally call, lead adviser detained. http://to.pbs.org/fsWae4 #Iran #IranElection";
// Path: src/test/java/com/urbanairship/datacube/tweetcountexample/Tweet.java
// public class Tweet {
//     private static final Pattern hashtagPattern = Pattern.compile("#(\\w+)");
//     private static final Pattern retweetFromPattern = Pattern.compile("RT @(\\w+)");
// 
//     public final DateTime time;
//     public final String username;
//     public final Optional<String> retweetedFrom;
//     public final String text;
//     public final Set<String> hashTags;
// 
//     public Tweet(String fileLine) {
//         String[] tokens = fileLine.split("\\t");
// 
//         time = new DateTime(Date.parse(tokens[1]), DateTimeZone.UTC);
//         username = tokens[2];
//         text = tokens[3];
// 
//         hashTags = new HashSet<String>(0);
//         Matcher hashtagMatcher = hashtagPattern.matcher(text);
//         while (hashtagMatcher.find()) {
//             hashTags.add(hashtagMatcher.group(1));
//         }
// 
//         Matcher retweetMatcher = retweetFromPattern.matcher(text);
//         if (retweetMatcher.find()) {
//             retweetedFrom = Optional.of(retweetMatcher.group(1));
//         } else {
//             retweetedFrom = Optional.absent();
//         }
//     }
// 
//     @Override
//     public String toString() {
//         StringBuilder sb = new StringBuilder();
//         sb.append("(username:" + username);
//         sb.append(", time:" + time);
//         sb.append(", retweeted:" + retweetedFrom);
//         sb.append(", text:" + text);
//         sb.append(", hashtags:" + hashTags);
//         sb.append(")");
//         return sb.toString();
//     }
// }


// Path: src/test/java/com/urbanairship/datacube/tweetcountexample/tests/TweetParseTest.java
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
import com.urbanairship.datacube.tweetcountexample.Tweet;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.Test;

package com.urbanairship.datacube.tweetcountexample.tests;


public class TweetParseTest {
    @Test
    public void testParsing() {
        String inputLine = "35720274552823808	Thu, 10 Feb 2011 15:22:31 +0000	iran88	RT @TehranBureau: As #Karroubi placed under house arrest after #25Bahman rally call, lead adviser detained. http://to.pbs.org/fsWae4 #Iran #IranElection";
        Tweet tweet = new Tweet(inputLine);