I'm going to get up to throw away my coffee cup while my teacher is teaching
Do you really need to throw away your coffee cup while they are teaching?
No, I just want to test how long he keeps on talking.
You shouldn't disrupt a class intentionally. If the teacher sees that you're doing this on purpose you could be asked to leave the class.
Fuck that, I came up with a good excuse to throw it away. He can't do anything about it.
It is their classroom and if you are intentionally causing disturbances and making it difficult for the other students to learn, the teacher can and likely will punish you for it. The first time they will probably just ask you not to do it again, but if you keep doing it, eventually you will get in more severe trouble. You should be courteous of other students and your teacher.