Your question engages the epistemology of testimony, which has recently gotten lots of attention among epistemologists.
But let's try to get a bit clearer on what the issue is. First, please understand that justification comes in degrees. If someone I don't know runs up to me and tells me that the president has been assassinated, I have some justification for believing it. But I certainly can't be said to know it, because that kind of testimony is not enough justification to "clear the bar." So epistemologists don't ever really accept that knowledge is justified true belief, where by "justified" they mean to count any level of justification as sufficient.
Secondly, one way to think about justification through testimony is to ask whether there is other evidence available. Back to my stranger telling me about the assassination. I notice that there is a TV store nearby and can see what is playing on the screens. I see no evidence of an assassination. Now how good is the justification the stranger provided? But if I see breaking news of an assassination, well...that is more (and more reliable) testimony (in most cases--not counting the "news" channels that really aren't!).
Finally, we might consider what we know about the source of the testimony. Do wwe have reason to believe that the person providing it has relevant expertise (such as a teacher)--or is it just heresay? So we need to judge the quality of the testimony and the qualifications of the one giving it. These are relevant to the question of how much justification the testimony confers.