Skip to content

Commit

Permalink
[refs #1] - add place testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjoy-sust committed Jan 16, 2018
1 parent d354f55 commit 1b9cce0
Showing 1 changed file with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,34 @@ public class PlaceRepositoryTest {
PlaceRepository placeRepository;

@Test
public void findPathByName()
{
PlaceEntity syl = placeRepository.findByName("Comilla");
Assert.assertNotNull(syl);
public void addTest() {
PlaceEntity placeEntity = new PlaceEntity();
placeEntity.setName("Sylhet");
placeEntity.setCode("SYL");
placeEntity.setLatitude(24.894929);
placeEntity.setLongitude(91.868706);
PlaceEntity save = placeRepository.save(placeEntity);
long id = save.getId();
Assert.assertNotNull(save);
placeRepository.delete(save);
Assert.assertNull(placeRepository.findOne(id));
}

@Test(expected = Exception.class)
public void addEmptyObj() {
PlaceEntity placeEntity = new PlaceEntity();
placeRepository.save(placeEntity);
}

@Test
public void findPathByName() {
PlaceEntity placeEntity = placeRepository.findByName("Comilla");
Assert.assertEquals(placeEntity.getName(), "Comilla");
}

@Test
public void findPathByVal() {
PlaceEntity placeEntity = placeRepository.findByCode("CML");
Assert.assertEquals(placeEntity.getName(), "Comilla");
}
}

0 comments on commit 1b9cce0

Please sign in to comment.