use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class JudgmentRepositoryInstrumentedTest method getJudgmentById.
@Test
public void getJudgmentById() {
Judgement judgement = new Judgement();
judgement.setDistance(100);
judgement.setName("judgment");
judgement.setRewardId(93);
synchronized (this) {
judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
}
Judgement realmJudgment;
synchronized (this) {
realmJudgment = judgmentRepository.getJudgmentsById(93).first();
}
Assert.assertEquals(judgement.getDistance(), realmJudgment.getDistance());
Assert.assertEquals(judgement.getRewardId(), realmJudgment.getRewardId());
Assert.assertEquals(judgement.getName(), realmJudgment.getName());
}
use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class JudgmentRiderConnectionInstrumentedTest method addRewardRiderConnection.
@Test
public void addRewardRiderConnection() {
addRider();
addJudgment();
RealmList<Rider> riderList = new RealmList<>();
RealmList<Judgement> judgementList = new RealmList<>();
riderList.add(RiderPresenter.getInstance().getRiderByStartNr(15));
judgementList.add(JudgmentPresenter.getInstance().getJudgmentsById(93).first());
JudgmentRiderConnection judgmentRiderConnection = new JudgmentRiderConnection();
judgmentRiderConnection.setRank(1);
judgmentRiderConnection.setJudgements(judgementList);
judgmentRiderConnection.setRider(riderList);
synchronized (this) {
judgmentRiderConnectionRepository.addJudgmentRiderConnection(judgmentRiderConnection, onSaveJudgmentRiderConnectionCallback);
}
Assert.assertEquals(1, realm.where(JudgmentRiderConnection.class).findAll().first().getRank());
}
use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class JudgmentRiderConnectionInstrumentedTest method addJudgment.
private void addJudgment() {
Judgement judgement = new Judgement();
judgement.setDistance(100);
judgement.setName("judgment");
judgement.setRewardId(93);
synchronized (this) {
judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
}
}
use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class JudgmentRiderConnectionInstrumentedTest method clearAllRewardRiderConnections.
@Test
public void clearAllRewardRiderConnections() {
addRider();
addJudgment();
RealmList<Rider> riderList = new RealmList<>();
RealmList<Judgement> judgementList = new RealmList<>();
riderList.add(RiderPresenter.getInstance().getRiderByStartNr(15));
judgementList.add(JudgmentPresenter.getInstance().getJudgmentsById(93).first());
JudgmentRiderConnection judgmentRiderConnection = new JudgmentRiderConnection();
judgmentRiderConnection.setRank(1);
judgmentRiderConnection.setJudgements(judgementList);
judgmentRiderConnection.setRider(riderList);
synchronized (this) {
judgmentRiderConnectionRepository.addJudgmentRiderConnection(judgmentRiderConnection, onSaveJudgmentRiderConnectionCallback);
}
synchronized (this) {
judgmentRiderConnectionRepository.clearAllJudgmentRiderConnections();
}
Assert.assertEquals(0, realm.where(JudgmentRiderConnection.class).findAll().size());
}
use of ch.hsr.sa.radiotour.dataaccess.models.Judgement in project app by TourLive.
the class RewardRepositoryInstrumentedTest method initTestData.
@Before
public void initTestData() {
this.judgmentRepository = new JudgmentRepository();
this.rewardRepository = new RewardRepository();
realm = Realm.getInstance(RadioTourApplication.getInstance());
initCallbacks();
realm.executeTransaction(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
realm.where(Judgement.class).findAll().deleteAllFromRealm();
realm.where(Reward.class).findAll().deleteAllFromRealm();
}
});
Judgement judgement = new Judgement();
judgement.setDistance(100);
judgement.setName("judgment");
judgement.setRewardId(93);
synchronized (this) {
judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
judgement.setName("judgment2");
judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
}
}
Aggregations