Note extends Home { public void onClickPlus() { if (onPlus) { if (plus > 0) { plus--; } onPlus = false; } else { plus++; onPlus = true; } }  void onClickPlus(); public long id; public String title; public String summary; public String imagePath; public int plus; public boolean onPlus; }
@Test public void onClickPlus_plus_1() { Note note = new Note(); note.onClickPlus(); assertTrue(note.onPlus); assertEquals(note.plus, 1); }
@Test public void onClickPlus_cancel_plus_0() { Note note = new Note(); note.onPlus = true; note.onClickPlus(); assertFalse(note.onPlus); assertEquals(note.plus, 0); }
@Test public void onClickPlus_cancel_plus_1() { Note note = new Note(); note.onPlus = true; note.plus = 10; note.onClickPlus(); assertFalse(note.onPlus); assertEquals(note.plus, 9); }