protected void createNewWorkerId() {
        type.assertFull();
        if (workerId != null) {
            String err =  "Incorrect usage of createNewWorkerId(), current workerId is " + workerId + ", expecting null";
            LOG.error(err);
            throw new AssertionError(err);
        }
        synchronized (localState) {
            workerId = Utils.uuid();
            Map<String, Integer> workerToPort = localState.getApprovedWorkers();
            if (workerToPort == null) {
                workerToPort = new HashMap<>(1);
            }
            removeWorkersOn(workerToPort, port);
            workerToPort.put(workerId, port);
            localState.setApprovedWorkers(workerToPort);
            LOG.info("Created Worker ID {}", workerId);
        }
    }
@Test
    public void testCreateNewWorkerId() throws Exception {
        final String topoId = "test_topology";
        final int supervisorPort = 6628;
        final int port = 8080;
        LocalAssignment la = new LocalAssignment();
        la.set_topology_id(topoId);

        Map<String, Object> superConf = new HashMap<>();
        AdvancedFSOps ops = mock(AdvancedFSOps.class);
        when(ops.doRequiredTopoFilesExist(superConf, topoId)).thenReturn(true);

        LocalState ls = mock(LocalState.class);

        ResourceIsolationInterface iso = mock(ResourceIsolationInterface.class);

        MockBasicContainer mc = new MockBasicContainer(ContainerType.LAUNCH, superConf,
            "SUPERVISOR", supervisorPort, port, la, iso, ls, null, new StormMetricsRegistry(),
            new HashMap<>(), ops, "profile");
        //null worker id means generate one...

        assertNotNull(mc.workerId);
        verify(ls).getApprovedWorkers();
        Map<String, Integer> expectedNewState = new HashMap<>();
        expectedNewState.put(mc.workerId, port);
        verify(ls).setApprovedWorkers(expectedNewState);
    }