Skip to content
Permalink
Browse files

tested rendering attribute

  • Loading branch information...
maciejmikosik committed Apr 7, 2018
1 parent 771a703 commit 280e617ad0542371e20659fb1e0fa7f97faa64da
Showing with 20 additions and 3 deletions.
  1. +20 −3 test/java/org/logbuddy/renderer/TestTextRenderer.java
@@ -22,6 +22,7 @@
import org.junit.Before;
import org.junit.Test;
import org.logbuddy.Renderer;
import org.logbuddy.message.Attribute;

public class TestTextRenderer {
private Object object;
@@ -58,9 +59,12 @@ public void renders_null() {

@Test
public void renders_message() {
given(object = new Thread("content"));
given(attributeA = Object.class);
given(attributeB = String.class);
when(renderer.render(message(object)));
thenReturned(renderer.render(object));
}

@Test
public void renders_message_with_attributes() {
when(renderer.render(message(object)
.attribute(attributeA)
.attribute(attributeB)));
@@ -70,6 +74,19 @@ public void renders_message() {
renderer.render(object)));
}

@Test
public void renders_attribute() {
given(renderer = new TextRenderer() {
public String render(Object model) {
return model instanceof Attribute
? string
: super.render(model);
}
});
when(renderer.render(message(object).attribute(attributeA)));
thenReturned(renderer.render(message(object).attribute(string)));
}

@Test
public void renders_invoked_with_many_arguments() {
when(renderer.render(invoked(instance, method, asList(a, b, c))));

0 comments on commit 280e617

Please sign in to comment.
You can’t perform that action at this time.