In 1814 , Norwegians resisted the cession of their country to Sweden and adopted a new constitution .