// Path: telemetry-lib/src/main/java/com/yammer/telemetry/tracing/AnnotationData.java
// public interface AnnotationData {
//     long getLoggedAt();
// 
//     String getName();
// 
//     String getMessage();
// }
// 
// Path: telemetry-lib/src/test/java/com/yammer/telemetry/tracing/BeanSpanData.java
// public class BeanSpanData implements SpanData {
//     private int duration;
//     private String host;
//     private String name;
//     private Optional<BigInteger> parentSpanId;
//     private BigInteger spanId;
//     private long startTime;
//     private BigInteger traceId;
//     private List<AnnotationData> annotations;
// 
//     public BeanSpanData() {
//         this.spanId = BigInteger.TEN;
//         this.startTime = System.nanoTime();
//         traceId = BigInteger.ONE;
//         parentSpanId = Optional.absent();
//         name = "Some Name";
//         host = "Host-001";
//         duration = 100;
//         annotations = ImmutableList.of();
//     }
// 
//     public BeanSpanData(int duration, String host, String name, Optional<BigInteger> parentSpanId, BigInteger spanId, long startTime, BigInteger traceId, List<AnnotationData> annotations) {
//         this.duration = duration;
//         this.host = host;
//         this.name = name;
//         this.parentSpanId = parentSpanId;
//         this.spanId = spanId;
//         this.startTime = startTime;
//         this.traceId = traceId;
//         this.annotations = annotations;
//     }
// 
//     @Override
//     public BigInteger getTraceId() {
//         return traceId;
//     }
// 
//     @Override
//     public BigInteger getSpanId() {
//         return spanId;
//     }
// 
//     @Override
//     public Optional<BigInteger> getParentSpanId() {
//         return parentSpanId;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String getHost() {
//         return host;
//     }
// 
//     @Override
//     public long getStartTime() {
//         return startTime;
//     }
// 
//     @Override
//     public long getDuration() {
//         return duration;
//     }
// 
//     @Override
//     public List<AnnotationData> getAnnotations() {
//         return annotations;
//     }
// 
//     @SuppressWarnings("RedundantIfStatement")
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         BeanSpanData that = (BeanSpanData) o;
// 
//         if (duration != that.duration) return false;
//         if (startTime != that.startTime) return false;
//         if (annotations != null ? !annotations.equals(that.annotations) : that.annotations != null) return false;
//         if (host != null ? !host.equals(that.host) : that.host != null) return false;
//         if (name != null ? !name.equals(that.name) : that.name != null) return false;
//         if (parentSpanId != null ? !parentSpanId.equals(that.parentSpanId) : that.parentSpanId != null) return false;
//         if (spanId != null ? !spanId.equals(that.spanId) : that.spanId != null) return false;
//         if (traceId != null ? !traceId.equals(that.traceId) : that.traceId != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = duration;
//         result = 31 * result + (host != null ? host.hashCode() : 0);
//         result = 31 * result + (name != null ? name.hashCode() : 0);
//         result = 31 * result + (parentSpanId != null ? parentSpanId.hashCode() : 0);
//         result = 31 * result + (spanId != null ? spanId.hashCode() : 0);
//         result = 31 * result + (int) (startTime ^ (startTime >>> 32));
//         result = 31 * result + (traceId != null ? traceId.hashCode() : 0);
//         result = 31 * result + (annotations != null ? annotations.hashCode() : 0);
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "BeanSpanData{" +
//                 "duration=" + duration +
//                 ", host='" + host + '\'' +
//                 ", name='" + name + '\'' +
//                 ", parentSpanId=" + parentSpanId +
//                 ", spanId=" + spanId +
//                 ", startTime=" + startTime +
//                 ", traceId=" + traceId +
//                 ", annotations=" + annotations +
//                 '}';
//     }
// }


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.yammer.telemetry.tracing.AnnotationData;
import com.yammer.telemetry.tracing.BeanSpanData;
import org.junit.Test;
import java.io.IOException;
import java.io.StringWriter;
import java.math.BigInteger;
import static org.junit.Assert.assertEquals;
    public void testCreateWithNullFile() throws Exception {
        LogJobFactory.withFile(null);
    }

    @Test
    public void testCreateWithWriter() throws Exception {
        LogJobFactory.withWriter(new StringWriter());
    }

    @Test(expected = NullPointerException.class)
    public void testCreateWithNullWriter() throws Exception {
        LogJobFactory.withWriter(null);
    }

    @Test
    public void testWriteNull() throws Exception {
        StringWriter writer = new StringWriter();
        LogJobFactory logJobFactory = LogJobFactory.withWriter(writer);

        Runnable job = logJobFactory.createJob(null);
        job.run();

        assertEquals(String.format("null%n"), writer.toString());
    }

    @Test
    public void testWriteSpanData() throws Exception {
        StringWriter writer = new StringWriter();
        LogJobFactory logJobFactory = LogJobFactory.withWriter(writer);

// Path: telemetry-lib/src/main/java/com/yammer/telemetry/tracing/AnnotationData.java
// public interface AnnotationData {
//     long getLoggedAt();
// 
//     String getName();
// 
//     String getMessage();
// }
// 
// Path: telemetry-lib/src/test/java/com/yammer/telemetry/tracing/BeanSpanData.java
// public class BeanSpanData implements SpanData {
//     private int duration;
//     private String host;
//     private String name;
//     private Optional<BigInteger> parentSpanId;
//     private BigInteger spanId;
//     private long startTime;
//     private BigInteger traceId;
//     private List<AnnotationData> annotations;
// 
//     public BeanSpanData() {
//         this.spanId = BigInteger.TEN;
//         this.startTime = System.nanoTime();
//         traceId = BigInteger.ONE;
//         parentSpanId = Optional.absent();
//         name = "Some Name";
//         host = "Host-001";
//         duration = 100;
//         annotations = ImmutableList.of();
//     }
// 
//     public BeanSpanData(int duration, String host, String name, Optional<BigInteger> parentSpanId, BigInteger spanId, long startTime, BigInteger traceId, List<AnnotationData> annotations) {
//         this.duration = duration;
//         this.host = host;
//         this.name = name;
//         this.parentSpanId = parentSpanId;
//         this.spanId = spanId;
//         this.startTime = startTime;
//         this.traceId = traceId;
//         this.annotations = annotations;
//     }
// 
//     @Override
//     public BigInteger getTraceId() {
//         return traceId;
//     }
// 
//     @Override
//     public BigInteger getSpanId() {
//         return spanId;
//     }
// 
//     @Override
//     public Optional<BigInteger> getParentSpanId() {
//         return parentSpanId;
//     }
// 
//     @Override
//     public String getName() {
//         return name;
//     }
// 
//     @Override
//     public String getHost() {
//         return host;
//     }
// 
//     @Override
//     public long getStartTime() {
//         return startTime;
//     }
// 
//     @Override
//     public long getDuration() {
//         return duration;
//     }
// 
//     @Override
//     public List<AnnotationData> getAnnotations() {
//         return annotations;
//     }
// 
//     @SuppressWarnings("RedundantIfStatement")
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         BeanSpanData that = (BeanSpanData) o;
// 
//         if (duration != that.duration) return false;
//         if (startTime != that.startTime) return false;
//         if (annotations != null ? !annotations.equals(that.annotations) : that.annotations != null) return false;
//         if (host != null ? !host.equals(that.host) : that.host != null) return false;
//         if (name != null ? !name.equals(that.name) : that.name != null) return false;
//         if (parentSpanId != null ? !parentSpanId.equals(that.parentSpanId) : that.parentSpanId != null) return false;
//         if (spanId != null ? !spanId.equals(that.spanId) : that.spanId != null) return false;
//         if (traceId != null ? !traceId.equals(that.traceId) : that.traceId != null) return false;
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int result = duration;
//         result = 31 * result + (host != null ? host.hashCode() : 0);
//         result = 31 * result + (name != null ? name.hashCode() : 0);
//         result = 31 * result + (parentSpanId != null ? parentSpanId.hashCode() : 0);
//         result = 31 * result + (spanId != null ? spanId.hashCode() : 0);
//         result = 31 * result + (int) (startTime ^ (startTime >>> 32));
//         result = 31 * result + (traceId != null ? traceId.hashCode() : 0);
//         result = 31 * result + (annotations != null ? annotations.hashCode() : 0);
//         return result;
//     }
// 
//     @Override
//     public String toString() {
//         return "BeanSpanData{" +
//                 "duration=" + duration +
//                 ", host='" + host + '\'' +
//                 ", name='" + name + '\'' +
//                 ", parentSpanId=" + parentSpanId +
//                 ", spanId=" + spanId +
//                 ", startTime=" + startTime +
//                 ", traceId=" + traceId +
//                 ", annotations=" + annotations +
//                 '}';
//     }
// }


// Path: telemetry-lib/src/test/java/com/yammer/telemetry/tracing/logging/LogJobFactoryTest.java
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.yammer.telemetry.tracing.AnnotationData;
import com.yammer.telemetry.tracing.BeanSpanData;
import org.junit.Test;
import java.io.IOException;
import java.io.StringWriter;
import java.math.BigInteger;
import static org.junit.Assert.assertEquals;

    public void testCreateWithNullFile() throws Exception {
        LogJobFactory.withFile(null);
    }

    @Test
    public void testCreateWithWriter() throws Exception {
        LogJobFactory.withWriter(new StringWriter());
    }

    @Test(expected = NullPointerException.class)
    public void testCreateWithNullWriter() throws Exception {
        LogJobFactory.withWriter(null);
    }

    @Test
    public void testWriteNull() throws Exception {
        StringWriter writer = new StringWriter();
        LogJobFactory logJobFactory = LogJobFactory.withWriter(writer);

        Runnable job = logJobFactory.createJob(null);
        job.run();

        assertEquals(String.format("null%n"), writer.toString());
    }

    @Test
    public void testWriteSpanData() throws Exception {
        StringWriter writer = new StringWriter();
        LogJobFactory logJobFactory = LogJobFactory.withWriter(writer);

        BeanSpanData expectedData = new BeanSpanData(100, "host", "name", Optional.<BigInteger>absent(), BigInteger.ZERO, 15, BigInteger.ONE, ImmutableList.<AnnotationData>of());