@Test
public void postPotentialDuplicateNoAccessToTeiA()
{

    TrackedEntityInstance teiA = new TrackedEntityInstance();
    teiA.setUid( "ABCDEFGHIJ1" );
    Mockito.when( trackedEntityInstanceService.getTrackedEntityInstance( Mockito.eq( "ABCDEFGHIJ1" ) ) )
        .thenReturn( teiA );
    Mockito.when( trackerAccessManager.canRead( Mockito.any(), Mockito.eq( teiA ) ) ).thenReturn(
        Lists.newArrayList( "Error" ) );
    try
    {
        controller.postPotentialDuplicate( new PotentialDuplicate( "ABCDEFGHIJ1" ) );
    }
    catch ( WebMessageException e )
    {
        WebMessage wm = e.getWebMessage();
        assertEquals( "Forbidden", wm.getHttpStatus() );
        assertEquals( 403, wm.getHttpStatusCode().intValue() );
        assertEquals( Status.ERROR, wm.getStatus() );
        assertEquals( "You don't have read access to 'ABCDEFGHIJ1'.", wm.getMessage() );
    }
}