package org.ovirt.engine.core.bll;

import org.junit.Test;
import org.ovirt.engine.core.common.action.VdcActionType;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import static org.junit.Assert.assertTrue;

public class VdcActionTypeTest {
    private static final int bitsetSize = 5000;

    @Test
    public void testAuditLogTypeValueUniqueness() {
        BitSet bitset = new BitSet(bitsetSize);
        Set<Integer> nonUniqueValues = new TreeSet<Integer>();

        for (VdcActionType vat : VdcActionType.values()) {
            if (bitset.get(vat.getValue())) {
                nonUniqueValues.add(vat.getValue());
            }
            else {
                bitset.set(vat.getValue());
            }
        }
        assertTrue("VdcActionType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty());
    }

    @Test
    public void testCommandClassExistance() {
        List<VdcActionType> missingCommands = new ArrayList<>();
        for (VdcActionType vat : VdcActionType.values()) {
            if (vat != VdcActionType.Unknown) {
                if (CommandsFactory.getCommandClass(vat.name()) == null){
                    missingCommands.add(vat);
                }
            }
        }
        assertTrue("VdcActionType contains the following values that does not correspond to an existing command class: " + missingCommands,
                missingCommands.isEmpty());
    }
}

package org.ovirt.engine.core.bll;

import org.junit.Test;
import org.ovirt.engine.core.common.action.VdcActionType;

import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

import static org.junit.Assert.assertTrue;

public class VdcActionTypeTest {
    private static final int bitSetSize = 5000;

    @Test
    public void testAuditLogTypeValueUniqueness() {
        BitSet bitset = new BitSet(bitSetSize);
        Set<Integer> nonUniqueValues = new TreeSet<Integer>();

        for (VdcActionType vat : VdcActionType.values()) {
            if (bitset.get(vat.getValue())) {
                nonUniqueValues.add(vat.getValue());
            }
            else {
                bitset.set(vat.getValue());
            }
        }
        assertTrue("VdcActionType contains the following non unique values: " + nonUniqueValues, nonUniqueValues.isEmpty());
    }

    @Test
    public void testCommandClassExistence() {
        List<VdcActionType> missingCommands = new ArrayList<>();
        for (VdcActionType vat : VdcActionType.values()) {
            if (vat != VdcActionType.Unknown) {
                if (CommandsFactory.getCommandClass(vat.name()) == null){
                    missingCommands.add(vat);
                }
            }
        }
        assertTrue("VdcActionType contains the following values that does not correspond to an existing command class: " + missingCommands,
                missingCommands.isEmpty());
    }
}

fix typos in test.