@Test public void testGroups() { List<AutoScalingGroup> asgList = new LinkedList<AutoScalingGroup>(); asgList.add(mkAsg("asg1", "i-123456780")); asgList.add(mkAsg("asg2", "i-123456781")); when(awsMock.describeAutoScalingGroups((String[]) null)).thenReturn(asgList); List<InstanceGroup> groups = crawler.groups(); verify(awsMock, times(1)).describeAutoScalingGroups((String[]) null); Assert.assertEquals(groups.size(), 2); Assert.assertEquals(groups.get(0).type(), ASGChaosCrawler.Types.ASG); Assert.assertEquals(groups.get(0).name(), "asg1"); Assert.assertEquals(groups.get(0).instances().size(), 1); Assert.assertEquals(groups.get(0).instances().get(0), "i-123456780"); Assert.assertEquals(groups.get(1).type(), ASGChaosCrawler.Types.ASG); Assert.assertEquals(groups.get(1).name(), "asg2"); Assert.assertEquals(groups.get(1).instances().size(), 1); Assert.assertEquals(groups.get(1).instances().get(0), "i-123456781"); }
@Test public void testGroupTypes() { EnumSet<?> types = crawler.groupTypes(); Assert.assertEquals(types.size(), 1); Assert.assertEquals(types.iterator().next().name(), "ASG"); }