@Override
    public MastershipTerm getTermFor(NetworkId networkId, DeviceId deviceId) {
        Map<DeviceId, NodeId> masterMap = getMasterMap(networkId);
        Map<DeviceId, AtomicInteger> termMap = getTermMap(networkId);

        if ((termMap.get(deviceId) == null)) {
            return MastershipTerm.of(masterMap.get(deviceId), NOTHING);
        }
        return MastershipTerm.of(
                masterMap.get(deviceId), termMap.get(deviceId).get());
    }
@Test
    public void getTermFor() {
        put(VNID1, VDID1, N1, true, true);
        assertEquals("wrong term", MastershipTerm.of(N1, 0),
                     sms.getTermFor(VNID1, VDID1));

        //switch to N2 and back - 2 term switches
        sms.setMaster(VNID1, N2, VDID1);
        sms.setMaster(VNID1, N1, VDID1);
        assertEquals("wrong term", MastershipTerm.of(N1, 2),
                     sms.getTermFor(VNID1, VDID1));
    }