Search in sources :

Example 6 with HallRepository

use of com.management.repositories.HallRepository in project Internet-Software-Architectures by zivko11.

the class HallManagerTests method ReadHall_ReturnsHall.

@Test
public void ReadHall_ReturnsHall() {
    // Arrange
    Mockery mock = new Mockery();
    hallRepository = mock.mock(HallRepository.class);
    final Hall hall = new Hall();
    hall.setHallName("A1");
    mock.checking(new Expectations() {

        {
            oneOf(hallRepository).findOne(1);
            will(returnValue(hall));
        }
    });
    HallManager manager = new HallManager(hallRepository);
    // Act
    HallDTO dto = manager.Read(1);
    // Assert
    Assert.assertNotNull(dto);
    Assert.assertEquals(dto.getHallId(), hall.getHallId());
    Assert.assertEquals(dto.getHallName(), hall.getHallName());
    mock.assertIsSatisfied();
}
Also used : Expectations(org.jmock.Expectations) Hall(com.management.entities.Hall) HallDTO(com.management.dto.HallDTO) Mockery(org.jmock.Mockery) HallRepository(com.management.repositories.HallRepository) Test(org.junit.Test)

Aggregations

HallRepository (com.management.repositories.HallRepository)6 Expectations (org.jmock.Expectations)6 Mockery (org.jmock.Mockery)6 Test (org.junit.Test)6 HallDTO (com.management.dto.HallDTO)5 Hall (com.management.entities.Hall)4 HallManager (com.management.managers.HallManager)3 ArrayList (java.util.ArrayList)2 List (java.util.List)1