Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.

This commit is contained in:
Ilkka Seppala
2015-12-25 23:49:28 +02:00
parent 9fbb085985
commit cec9a99410
167 changed files with 1242 additions and 969 deletions

View File

@ -20,28 +20,28 @@ public class App {
public static void main(String[] args) {
TreasureChest chest = new TreasureChest();
ItemIterator ringIterator = chest.Iterator(ItemType.RING);
ItemIterator ringIterator = chest.iterator(ItemType.RING);
while (ringIterator.hasNext()) {
System.out.println(ringIterator.next());
}
System.out.println("----------");
ItemIterator potionIterator = chest.Iterator(ItemType.POTION);
ItemIterator potionIterator = chest.iterator(ItemType.POTION);
while (potionIterator.hasNext()) {
System.out.println(potionIterator.next());
}
System.out.println("----------");
ItemIterator weaponIterator = chest.Iterator(ItemType.WEAPON);
ItemIterator weaponIterator = chest.iterator(ItemType.WEAPON);
while (weaponIterator.hasNext()) {
System.out.println(weaponIterator.next());
}
System.out.println("----------");
ItemIterator it = chest.Iterator(ItemType.ANY);
ItemIterator it = chest.iterator(ItemType.ANY);
while (it.hasNext()) {
System.out.println(it.next());
}

View File

@ -12,6 +12,9 @@ public class TreasureChest {
private List<Item> items;
/**
* Constructor
*/
public TreasureChest() {
items = new ArrayList<>();
items.add(new Item(ItemType.POTION, "Potion of courage"));
@ -26,10 +29,13 @@ public class TreasureChest {
items.add(new Item(ItemType.WEAPON, "Dagger of poison"));
}
ItemIterator Iterator(ItemType type) {
return new TreasureChestItemIterator(this, type);
ItemIterator iterator(ItemType itemType) {
return new TreasureChestItemIterator(this, itemType);
}
/**
* Get all items
*/
public List<Item> getItems() {
ArrayList<Item> list = new ArrayList<>();
list.addAll(items);

View File

@ -13,6 +13,9 @@ public class TreasureChestItemIterator implements ItemIterator {
private int idx;
private ItemType type;
/**
* Constructor
*/
public TreasureChestItemIterator(TreasureChest chest, ItemType type) {
this.chest = chest;
this.type = type;

View File

@ -60,7 +60,7 @@ public class TreasureChestTest {
@Test
public void testIterator() {
final TreasureChest chest = new TreasureChest();
final ItemIterator iterator = chest.Iterator(expectedItem.getType());
final ItemIterator iterator = chest.iterator(expectedItem.getType());
assertNotNull(iterator);
while (iterator.hasNext()) {