@Test
public void testRewrite() throws Exception {

  ContentEntity contentEntity = mock( ContentEntity.class );
  ContentEntity dataEntity = mock( ContentEntity.class );
  Repository repository = mock( Repository.class );
  doReturn( repository ).when( dataEntity ).getRepository();
  String result = rewriter.rewrite( contentEntity, dataEntity );
  assertEquals( "null", result );
  ContentLocation location = mock( ContentLocation.class );
  doReturn( "parent" ).when( location ).getName();
  doReturn( location ).when( dataEntity ).getParent();
  doReturn( repository ).when( dataEntity ).getRepository();
  result = rewriter.rewrite( contentEntity, dataEntity );
  assertEquals( "parent/null", result );
  ContentLocation locationContent = mock( ContentLocation.class );
  doReturn( "parent" ).when( locationContent ).getName();
  doReturn( locationContent ).when( repository ).getRoot();
  doReturn( repository ).when( dataEntity ).getRepository();
  result = rewriter.rewrite( contentEntity, dataEntity );
  assertEquals( "null", result );
  ContentLocation locationParent = mock( ContentLocation.class );
  doReturn( "parent" ).when( locationParent ).getName();
  locationContent = mock( ContentLocation.class );
  doReturn( "content" ).when( locationContent ).getName();
  doReturn( locationContent ).when( repository ).getRoot();
  result = rewriter.rewrite( contentEntity, dataEntity );
  assertEquals( "parent/null", result );
  rewriter = new PentahoURLRewriter( "{0}", false );
  result = rewriter.rewrite( contentEntity, dataEntity );
  assertEquals( "parent/null", result );
}