En 26-årig man döms att betala böter och 8 000 kronor i skadestånd efter att han spottat på en polis.