This may not be the right place to ask this. However, I was just hired a couple of months ago at my first programming job as a student developer for my university, and I have had to write a couple of unit tests already. Before I was hired, I had the opportunity to talk to another developer who made the case unit tests were not necessary. He made the case: if you throw data at a method should know what comes out without writing a test, which I think makes sense.
For example (Java):
public int Add(int num1, int num2) {
return(num1 + num2);
}
//if I call Add(2,2) I know I should get 4,
//if I call Add(5,6) I know I should get 11,
//etc...
I tried asking my co-worker about this and his response was more or less along the lines of, everyone else does it so we have to.
So, I guess my question is: Why are unit tests necessary if you can just test your code by calling it repeatedly with dummy data rather than testing it once with a unit test?