/** * マイナスしてからプラスする。 * * <p>最初のマイナスは取り消されて、プラスだけが残る * * @author shin1ogawa */ @Test public void minusAndPlus() { int beforePlusCount = tester.count(Plus.class); int beforeMinusCount = tester.count(Minus.class); PlusAndMinusService.minus(account.getKey(), discussions.get(0).getKey()); PlusAndMinusService.plus(account.getKey(), discussions.get(0).getKey()); int afterPlusCount = tester.count(Plus.class); int afterMinusCount = tester.count(Minus.class); assertThat(afterPlusCount, is(beforePlusCount + 1)); assertThat(afterMinusCount, is(beforeMinusCount)); }
@Override public void setUp() throws Exception { super.setUp(); account = new Account(); account.setKey(Datastore.createKey(Account.class, 1)); Datastore.put(account); discussions = new ArrayList<Submission>(); for (int i = 0; i < 10; i++) { Submission submission = new Submission(); submission.setTitle("title" + i); submission.setDescription("description" + i); submission.setAuthor(Datastore.createKey(Account.class, i + 1)); submission.setAuthorName("author" + i); discussions.add(submission); } Datastore.put(discussions); }