public GearAssert assertGear(String id) { assertNotNull(id); for (IGear gear : gearGroup.getGears()) { if (id.equals(gear.getId())) { return new GearAssert(gear); } } fail("gear group " + gearGroup.getName() + " does not contain a gear with id " + id); return null; }
public GearAssert assertGear(int number) { assertThat(number).isGreaterThanOrEqualTo(0); assertThat(number) .as("gear group " + gearGroup.getName() + " does not contain " + number + " gears") .isLessThanOrEqualTo(gearGroup.getGears().size()); int i = 0; for (IGear gear : gearGroup.getGears()) { if (i == number) { return new GearAssert(gear); } } return null; }
public GearGroupAssert hasCartridges(final String... expectedCartridgeNames) { final Collection<ICartridge> existingCartridges = gearGroup.getCartridges(); final List<String> existingCartridgeNames = new ArrayList<String>(); final Iterator<ICartridge> cartridgeIterator = existingCartridges.iterator(); for (int i = 0; i < existingCartridges.size(); i++) { existingCartridgeNames.add(cartridgeIterator.next().getName()); } Assertions.assertThat(existingCartridgeNames).isEqualTo(Arrays.asList(expectedCartridgeNames)); return this; }
public GearGroupAssert hasGears() { assertThat(gearGroup.getGears()).isNotNull(); assertThat(gearGroup.getGears().size()).isPositive(); return this; }
public GearGroupAssert hasUUID() { assertNotNull(gearGroup.getUUID()); return this; }
public GearGroupAssert hasUUID(String uuid) { assertEquals(uuid, gearGroup.getUUID()); return this; }
public GearGroupAssert hasName(String name) { assertEquals(name, gearGroup.getName()); return this; }