@@ -0,0 +1,2332 @@
+/*%0A * Copyright (C) 2015 Pedro Vicente Gomez Sanchez.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.github.pedrovgs.lynx.renderer;%0A%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.widget.TextView;%0Aimport com.github.pedrovgs.lynx.R;%0Aimport com.github.pedrovgs.lynx.model.Trace;%0Aimport com.github.pedrovgs.lynx.model.TraceLevel;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.robolectric.Robolectric;%0Aimport org.robolectric.RobolectricTestRunner;%0Aimport org.robolectric.annotation.Config;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * @author Pedro Vicente G%C3%B3mez S%C3%A1nchez.%0A */%0A@Config(emulateSdk = 18) @RunWith(RobolectricTestRunner.class) public class TraceRendererTest %7B%0A%0A  private static final TraceLevel ANY_TRACE_LEVEL = TraceLevel.WTF;%0A  private static final String ANY_TRACE_MESSAGE =%0A      %2202-08 19:54:30.145 Lynx%EF%B9%95 WTF!!! My app is not working!!%22;%0A%0A  private TraceRenderer traceRenderer;%0A%0A  @Before public void setUp() %7B%0A    traceRenderer = new TraceRenderer();%0A  %7D%0A%0A  @Test public void shouldRenderFullTracePlusTraceLevelInformation() %7B%0A    Trace anyTrace = givenAnyTrace();%0A%0A    View view = renderTrace(anyTrace);%0A    String traceRendered = ((TextView) view.findViewById(R.id.tv_trace)).getText().toString();%0A%0A    String expectedTrace = %22 %22 + anyTrace.getLevel().getValue() + %22  %22 + anyTrace.getMessage();%0A    assertEquals(expectedTrace, traceRendered);%0A  %7D%0A%0A  private Trace givenAnyTrace() %7B%0A    return new Trace(ANY_TRACE_LEVEL, ANY_TRACE_MESSAGE);%0A  %7D%0A%0A  private View renderTrace(Trace anyTrace) %7B%0A    LayoutInflater layoutInflater = LayoutInflater.from(Robolectric.application);%0A    traceRenderer.onCreate(anyTrace, layoutInflater, null);%0A    traceRenderer.render();%0A    return traceRenderer.getRootView();%0A  %7D%0A%7D%0A

Add test to TraceRenderer to check is rendering trace information as expected inside the TextView