assertThat(gaugeRepository.findOne(gaugeName).getValue(), equalTo(0L));
}
@Test
public void testCrud() {
GaugeRepository repo = gaugeRepository;
String myGaugeName = "myGauge";
String yourGaugeName = "yourGauge";
// Create and save a Gauge named 'myGauge'
Gauge g1 = new Gauge(myGaugeName);
Gauge myGauge = repo.save(g1);
assertThat(myGauge.getName(), is(notNullValue()));
// Create and save a Gauge named 'yourGauge'
Gauge g2 = new Gauge(yourGaugeName);
Gauge yourGauge = repo.save(g2);
assertThat(yourGauge.getName(), is(notNullValue()));
assertTrue(repo.exists(yourGauge.getName()));
// Retrieve by name and compare for equality to previously saved instance.
Gauge result = repo.findOne(myGaugeName);
assertThat(result, equalTo(myGauge));
result = repo.findOne(yourGauge.getName());
assertThat(result, equalTo(yourGauge));
List<Gauge> gauges = (List<Gauge>) repo.findAll();
assertThat(gauges.size(), equalTo(2));
repo.delete(myGauge);
assertThat(repo.findOne(myGaugeName), is(nullValue()));
repo.deleteAll();
assertThat(repo.findOne(yourGaugeName), is(nullValue()));
assertEquals(0, repo.count());
repo.save(Arrays.asList(g1, g2));
assertThat(repo.count(), equalTo(2L));
repo.delete(Arrays.asList(g1, g2));
assertEquals(0, repo.count());
}