Both were attempted to unify their ethnic people under one government. Germany unified from the Germany states and the former Prussia. Italy unified from the Italian states.
Both unified under one national culture focused on one language and a unified religious beliefs. Both forced or "strongly suggested" people with differing beliefs or culture leave the newly formed state.
Germany unified more easily than Italy as the German states were used to rule by the Holy Roman Emperor whereas the Italian states had more freedom and were independent. Politics and small scale fighting were necessary to convince the states to join.