Added unit test to verify ordering

This commit is contained in:
Patrick Dube 2016-06-02 13:44:39 -04:00
parent caf4a48075
commit 4c97a3981d
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
package com.cloud.agent.api.routing;
import static org.junit.Assert.assertEquals;
import java.util.List;
import org.junit.Test;
import com.cloud.agent.api.to.NetworkACLTO;
import com.google.common.collect.Lists;
public class SetNetworkACLCommandTest {
@Test
public void testNetworkAclRuleOrdering(){
//given
List<NetworkACLTO> aclList = Lists.newArrayList();
aclList.add(new NetworkACLTO(3, null, null, null, null, false, false, null, null, null, null, false, 3));
aclList.add(new NetworkACLTO(1, null, null, null, null, false, false, null, null, null, null, false, 1));
aclList.add(new NetworkACLTO(2, null, null, null, null, false, false, null, null, null, null, false, 2));
SetNetworkACLCommand cmd = new SetNetworkACLCommand(aclList, null);
//when
cmd.orderNetworkAclRulesByRuleNumber(aclList);
//then
for(int i=0; i< aclList.size();i++){
assertEquals(aclList.get(i).getNumber(), i+1);
}
}
}