use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class RewardRepositoryInstrumentedTest method addReward.
@Test
public void addReward() {
RealmList<Judgement> judgements = new RealmList<>();
RealmResults<Judgement> realmJudgments = realm.where(Judgement.class).findAll();
judgements.addAll(realmJudgments);
Reward reward = new Reward();
reward.setPoints(new RealmList<Integer>(1, 3, 5));
reward.setMoney(new RealmList<Integer>(100, 300, 500));
reward.setType(RewardType.POINTS);
reward.setRewardId(93);
reward.setRewardJudgements(judgements);
synchronized (this) {
rewardRepository.addReward(reward, onSaveRewardCallback);
}
Assert.assertEquals(93, realm.where(Reward.class).findAll().first().getRewardId().intValue());
Assert.assertEquals(300, realm.where(Reward.class).findAll().first().getMoney().get(1).intValue());
Assert.assertEquals(2, realm.where(Reward.class).findAll().first().getRewardJudgements().size());
Assert.assertEquals(93, realm.where(Reward.class).findAll().first().getRewardJudgements().first().getRewardId());
}
Aggregations