The band offsets at a heterojunction lies between two limits, those given by the electron affinity rule and the matching of the charge neutrality levels (CNLs) or branch point energies. It is shown that it has been difficult to compare these cases because most experimental and theoretical tests require a lattice-matching across the heterojunction, and most semiconductors with the same lattice constant have similar average band energies referenced to the vacuum level. A second point is that the CNL when referenced to the vacuum level varies surprisingly weakly with the midgap energy referenced to the vacuum level. A calculation of band offsets for larger lattice mismatch heterojunctions provides a strong test, whose result is found to favour the CNL matching model. This result is important for the majority of practical device heterojunctions, where there is no match due to poly-crystallinity or other effects. For other cases whether the device consists of molecules, the electron affinity rule holds.