Format Google Coding style

This commit is contained in:
jiajun.chou 2020-08-13 21:23:28 +08:00
parent fbe24e35b5
commit 4b94f81e2e
4 changed files with 100 additions and 104 deletions

View File

@ -9,8 +9,7 @@ class GildedRose {
public void updateQuality() { public void updateQuality() {
for (int i = 0; i < items.length; i++) { for (int i = 0; i < items.length; i++) {
if (!items[i].name.equals("Aged Brie") if (!items[i].name.equals("Aged Brie") && !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
&& !items[i].name.equals("Backstage passes to a TAFKAL80ETC concert")) {
if (items[i].quality > 0) { if (items[i].quality > 0) {
if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) { if (!items[i].name.equals("Sulfuras, Hand of Ragnaros")) {
items[i].quality = items[i].quality - 1; items[i].quality = items[i].quality - 1;

View File

@ -1,14 +1,13 @@
package com.gildedrose; package com.gildedrose;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class GildedRoseTest { class GildedRoseTest {
@Test @Test
void foo() { void foo() {
Item[] items = new Item[] { new Item("foo", 0, 0) }; Item[] items = new Item[] {new Item("foo", 0, 0)};
GildedRose app = new GildedRose(items); GildedRose app = new GildedRose(items);
app.updateQuality(); app.updateQuality();
assertEquals("fixme", app.items[0].name); assertEquals("fixme", app.items[0].name);

View File

@ -4,17 +4,15 @@ public class TexttestFixture {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("OMGHAI!"); System.out.println("OMGHAI!");
Item[] items = new Item[] { Item[] items = new Item[] {new Item("+5 Dexterity Vest", 10, 20), //
new Item("+5 Dexterity Vest", 10, 20), //
new Item("Aged Brie", 2, 0), // new Item("Aged Brie", 2, 0), //
new Item("Elixir of the Mongoose", 5, 7), // new Item("Elixir of the Mongoose", 5, 7), //
new Item("Sulfuras, Hand of Ragnaros", 0, 80), // new Item("Sulfuras, Hand of Ragnaros", 0, 80), //
new Item("Sulfuras, Hand of Ragnaros", -1, 80), new Item("Sulfuras, Hand of Ragnaros", -1, 80), new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
new Item("Backstage passes to a TAFKAL80ETC concert", 15, 20),
new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49), new Item("Backstage passes to a TAFKAL80ETC concert", 10, 49),
new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49), new Item("Backstage passes to a TAFKAL80ETC concert", 5, 49),
// this conjured item does not work properly yet // this conjured item does not work properly yet
new Item("Conjured Mana Cake", 3, 6) }; new Item("Conjured Mana Cake", 3, 6)};
GildedRose app = new GildedRose(items); GildedRose app = new GildedRose(items);