def test_is_unhappy(self, sys_mock): """This is mocking the complete library. Try that in Java.""" # setup foobar = Foobar() # exercise foobar._i_am_happy(False) # Verify self.assertEqual(1, sys_mock.exit.call_count)
def test_is_happy(self): """This is testing a private method""" # setup foobar = Foobar() # exercise result = foobar._i_am_happy(True) # verify self.assertEqual("happy", result)