TraceRendererBuilder extends RendererBuilder<Trace> { @Override protected Class getPrototypeClass(Trace content) { Class rendererClass = null; TraceLevel traceLevel = content.getLevel(); switch (traceLevel) { case ASSERT: rendererClass = AssertTraceRenderer.class; break; case DEBUG: rendererClass = DebugTraceRenderer.class; break; case INFO: rendererClass = InfoTraceRenderer.class; break; case WARNING: rendererClass = WarningTraceRenderer.class; break; case ERROR: rendererClass = ErrorTraceRenderer.class; break; case WTF: rendererClass = WtfTraceRenderer.class; break; default: rendererClass = TraceRenderer.class; } return rendererClass; } TraceRendererBuilder(LynxConfig lynxConfig);   }
@Test public void shouldReturnAssertTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.ASSERT, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, AssertTraceRenderer.class); }
@Test public void shouldReturnTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.VERBOSE, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, TraceRenderer.class); }
@Test public void shouldReturnDebugTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.DEBUG, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, DebugTraceRenderer.class); }
@Test public void shouldReturnInfoTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.INFO, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, InfoTraceRenderer.class); }
@Test public void shouldReturnWarningTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.WARNING, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, WarningTraceRenderer.class); }
@Test public void shouldReturnErrorTraceRendererAsPrototypeIfTraceLevelEqualsToVerbose() { Trace trace = new Trace(TraceLevel.ERROR, ANY_TRACE_MESSAGE); Class traceRendererClass = traceRendererBuilder.getPrototypeClass(trace); assertEquals(traceRendererClass, ErrorTraceRenderer.class); }