package <%= packageName %>.web.rest;

<%_
const saveMethodName = ormTool !== 'mybatis' ? 'saveAndFlush' : 'insert' _%>
import <%= packageName %>.<%= mainClass %>;
import <%= packageName %>.domain.BigScreen;
import <%= packageName %>.domain.User;
import <%= packageName %>.domain.Department;
import <%= packageName %>.domain.BigScreenCategory;
import <%= packageName %>.repository.BigScreenRepository;
import <%= packageName %>.service.BigScreenConfigService;
import <%= packageName %>.service.BigScreenService;
import <%= packageName %>.service.CommonConditionQueryService;
import <%= packageName %>.service.dto.BigScreenDTO;
import <%= packageName %>.service.mapper.BigScreenMapper;
import <%= packageName %>.web.rest.errors.ExceptionTranslator;
import <%= packageName %>.service.criteria.BigScreenCriteria;
import <%= packageName %>.service.BigScreenQueryService;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Base64Utils;
import org.springframework.validation.Validator;

import javax.persistence.EntityManager;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.time.ZoneOffset;
import java.time.ZoneId;
import java.util.List;

import static <%= packageName %>.web.rest.TestUtil.sameInstant;
import static <%= packageName %>.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

/**
 * Integration tests for the {@link BigScreenResource} REST controller.
 */
@SpringBootTest(classes = <%= mainClass %>.class)
public class BigScreenResourceIT {

    private static final String DEFAULT_TITLE = "AAAAAAAAAA";
    private static final String UPDATED_TITLE = "BBBBBBBBBB";

    private static final String DEFAULT_BACKGROUND_URL = "AAAAAAAAAA";
    private static final String UPDATED_BACKGROUND_URL = "BBBBBBBBBB";

    private static final String DEFAULT_PASSWORD = "AAAAAAAAAA";
    private static final String UPDATED_PASSWORD = "BBBBBBBBBB";

    private static final ZonedDateTime DEFAULT_CREATE_TIME = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0L), ZoneOffset.UTC);
    private static final ZonedDateTime UPDATED_CREATE_TIME = ZonedDateTime.now(ZoneId.systemDefault()).withNano(0);
    private static final ZonedDateTime SMALLER_CREATE_TIME = ZonedDateTime.ofInstant(Instant.ofEpochMilli(-1L), ZoneOffset.UTC);

    private static final ZonedDateTime DEFAULT_UPDATE_TIME = ZonedDateTime.ofInstant(Instant.ofEpochMilli(0L), ZoneOffset.UTC);
    private static final ZonedDateTime UPDATED_UPDATE_TIME = ZonedDateTime.now(ZoneId.systemDefault()).withNano(0);
    private static final ZonedDateTime SMALLER_UPDATE_TIME = ZonedDateTime.ofInstant(Instant.ofEpochMilli(-1L), ZoneOffset.UTC);

    private static final Boolean DEFAULT_PUBLISHED = false;
    private static final Boolean UPDATED_PUBLISHED = true;

    @Autowired
    private BigScreenRepository bigScreenRepository;

    @Autowired
    private BigScreenMapper bigScreenMapper;

    @Autowired
    private BigScreenService bigScreenService;

    @Autowired
    private BigScreenConfigService bigScreenConfigService;

    @Autowired
    private CommonConditionQueryService commonConditionQueryService;

    @Autowired
    private BigScreenQueryService bigScreenQueryService;

    @Autowired
    private MappingJackson2HttpMessageConverter jacksonMessageConverter;

    @Autowired
    private PageableHandlerMethodArgumentResolver pageableArgumentResolver;

    @Autowired
    private ExceptionTranslator exceptionTranslator;
<%_ if (ormTool === 'hibernate') { _%>

    @Autowired
    private EntityManager em;
<%_ } _%>

    @Autowired
    private Validator validator;

    @Autowired
    private MockMvc restBigScreenMockMvc;

    private BigScreen bigScreen;

    @BeforeEach
    public void setup() {
        MockitoAnnotations.initMocks(this);
        final BigScreenResource bigScreenResource = new BigScreenResource(bigScreenService, commonConditionQueryService, bigScreenQueryService, bigScreenConfigService);
        this.restBigScreenMockMvc = MockMvcBuilders.standaloneSetup(bigScreenResource)
            .setCustomArgumentResolvers(pageableArgumentResolver)
            .setControllerAdvice(exceptionTranslator)
            .setConversionService(createFormattingConversionService())
            .setMessageConverters(jacksonMessageConverter)
            .setValidator(validator).build();
    }

    /**
     * Create an entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static BigScreen createEntity(<% if (ormTool === 'hibernate') { %>EntityManager em<% } %>) {
        BigScreen bigScreen = new BigScreen()
            .title(DEFAULT_TITLE)
            .backgroundUrl(DEFAULT_BACKGROUND_URL)
            .password(DEFAULT_PASSWORD)
            .createTime(DEFAULT_CREATE_TIME)
            .updateTime(DEFAULT_UPDATE_TIME)
            .published(DEFAULT_PUBLISHED);
        return bigScreen;
    }
    /**
     * Create an updated entity for this test.
     *
     * This is a static method, as tests for other entities might also need it,
     * if they test an entity which requires the current entity.
     */
    public static BigScreen createUpdatedEntity(<% if (ormTool === 'hibernate') { %>EntityManager em<% } %>) {
        BigScreen bigScreen = new BigScreen()
            .title(UPDATED_TITLE)
            .backgroundUrl(UPDATED_BACKGROUND_URL)
            .password(UPDATED_PASSWORD)
            .createTime(UPDATED_CREATE_TIME)
            .updateTime(UPDATED_UPDATE_TIME)
            .published(UPDATED_PUBLISHED);
        return bigScreen;
    }

    @BeforeEach
    public void initTest() {
        bigScreen = createEntity(<% if (ormTool === 'hibernate') { %>em<% } %>);
    }

    @Test
    @Transactional
    public void createBigScreen() throws Exception {
        int databaseSizeBeforeCreate = bigScreenRepository.findAll().size();

        // Create the BigScreen
        BigScreenDTO bigScreenDTO = bigScreenMapper.toDto(bigScreen);
        restBigScreenMockMvc.perform(post("/api/big-screens")
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(bigScreenDTO)))
            .andExpect(status().isCreated());

        // Validate the BigScreen in the database
        List<BigScreen> bigScreenList = bigScreenRepository.findAll();
        assertThat(bigScreenList).hasSize(databaseSizeBeforeCreate + 1);
        BigScreen testBigScreen = bigScreenList.get(bigScreenList.size() - 1);
        assertThat(testBigScreen.getTitle()).isEqualTo(DEFAULT_TITLE);
        assertThat(testBigScreen.getBackgroundUrl()).isEqualTo(DEFAULT_BACKGROUND_URL);
        assertThat(testBigScreen.getPassword()).isEqualTo(DEFAULT_PASSWORD);
        assertThat(testBigScreen.getCreateTime()).isEqualTo(DEFAULT_CREATE_TIME);
        assertThat(testBigScreen.getUpdateTime()).isEqualTo(DEFAULT_UPDATE_TIME);
        assertThat(testBigScreen.getPublished()).isEqualTo(DEFAULT_PUBLISHED);
    }

    @Test
    @Transactional
    public void createBigScreenWithExistingId() throws Exception {
        int databaseSizeBeforeCreate = bigScreenRepository.findAll().size();

        // Create the BigScreen with an existing ID
        bigScreen.setId(1L);
        BigScreenDTO bigScreenDTO = bigScreenMapper.toDto(bigScreen);

        // An entity with an existing ID cannot be created, so this API call must fail
        restBigScreenMockMvc.perform(post("/api/big-screens")
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(bigScreenDTO)))
            .andExpect(status().isBadRequest());

        // Validate the BigScreen in the database
        List<BigScreen> bigScreenList = bigScreenRepository.findAll();
        assertThat(bigScreenList).hasSize(databaseSizeBeforeCreate);
    }


    @Test
    @Transactional
    public void getAllBigScreens() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList
        restBigScreenMockMvc.perform(get("/api/big-screens?sort=id,desc"))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(bigScreen.getId().intValue())))
            .andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE)))
            .andExpect(jsonPath("$.[*].backgroundUrl").value(hasItem(DEFAULT_BACKGROUND_URL.toString())))
            .andExpect(jsonPath("$.[*].password").value(hasItem(DEFAULT_PASSWORD)))
            .andExpect(jsonPath("$.[*].createTime").value(hasItem(sameInstant(DEFAULT_CREATE_TIME))))
            .andExpect(jsonPath("$.[*].updateTime").value(hasItem(sameInstant(DEFAULT_UPDATE_TIME))))
            .andExpect(jsonPath("$.[*].published").value(hasItem(DEFAULT_PUBLISHED.booleanValue())));
    }

    @Test
    @Transactional
    public void getBigScreen() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get the bigScreen
        restBigScreenMockMvc.perform(get("/api/big-screens/{id}", bigScreen.getId()))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.id").value(bigScreen.getId().intValue()))
            .andExpect(jsonPath("$.title").value(DEFAULT_TITLE))
            .andExpect(jsonPath("$.backgroundUrl").value(DEFAULT_BACKGROUND_URL.toString()))
            .andExpect(jsonPath("$.password").value(DEFAULT_PASSWORD))
            .andExpect(jsonPath("$.createTime").value(sameInstant(DEFAULT_CREATE_TIME)))
            .andExpect(jsonPath("$.updateTime").value(sameInstant(DEFAULT_UPDATE_TIME)))
            .andExpect(jsonPath("$.published").value(DEFAULT_PUBLISHED.booleanValue()));
    }


    @Test
    @Transactional
    public void getBigScreensByIdFiltering() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        Long id = bigScreen.getId();

        defaultBigScreenShouldBeFound("id.equals=" + id);
        defaultBigScreenShouldNotBeFound("id.notEquals=" + id);

        defaultBigScreenShouldBeFound("id.greaterThanOrEqual=" + id);
        defaultBigScreenShouldNotBeFound("id.greaterThan=" + id);

        defaultBigScreenShouldBeFound("id.lessThanOrEqual=" + id);
        defaultBigScreenShouldNotBeFound("id.lessThan=" + id);
    }


    @Test
    @Transactional
    public void getAllBigScreensByTitleIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title equals to DEFAULT_TITLE
        defaultBigScreenShouldBeFound("title.equals=" + DEFAULT_TITLE);

        // Get all the bigScreenList where title equals to UPDATED_TITLE
        defaultBigScreenShouldNotBeFound("title.equals=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBigScreensByTitleIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title not equals to DEFAULT_TITLE
        defaultBigScreenShouldNotBeFound("title.notEquals=" + DEFAULT_TITLE);

        // Get all the bigScreenList where title not equals to UPDATED_TITLE
        defaultBigScreenShouldBeFound("title.notEquals=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBigScreensByTitleIsInShouldWork() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title in DEFAULT_TITLE or UPDATED_TITLE
        defaultBigScreenShouldBeFound("title.in=" + DEFAULT_TITLE + "," + UPDATED_TITLE);

        // Get all the bigScreenList where title equals to UPDATED_TITLE
        defaultBigScreenShouldNotBeFound("title.in=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBigScreensByTitleIsNullOrNotNull() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title is not null
        defaultBigScreenShouldBeFound("title.specified=true");

        // Get all the bigScreenList where title is null
        defaultBigScreenShouldNotBeFound("title.specified=false");
    }
                @Test
    @Transactional
    public void getAllBigScreensByTitleContainsSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title contains DEFAULT_TITLE
        defaultBigScreenShouldBeFound("title.contains=" + DEFAULT_TITLE);

        // Get all the bigScreenList where title contains UPDATED_TITLE
        defaultBigScreenShouldNotBeFound("title.contains=" + UPDATED_TITLE);
    }

    @Test
    @Transactional
    public void getAllBigScreensByTitleNotContainsSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where title does not contain DEFAULT_TITLE
        defaultBigScreenShouldNotBeFound("title.doesNotContain=" + DEFAULT_TITLE);

        // Get all the bigScreenList where title does not contain UPDATED_TITLE
        defaultBigScreenShouldBeFound("title.doesNotContain=" + UPDATED_TITLE);
    }


    @Test
    @Transactional
    public void getAllBigScreensByPasswordIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password equals to DEFAULT_PASSWORD
        defaultBigScreenShouldBeFound("password.equals=" + DEFAULT_PASSWORD);

        // Get all the bigScreenList where password equals to UPDATED_PASSWORD
        defaultBigScreenShouldNotBeFound("password.equals=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPasswordIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password not equals to DEFAULT_PASSWORD
        defaultBigScreenShouldNotBeFound("password.notEquals=" + DEFAULT_PASSWORD);

        // Get all the bigScreenList where password not equals to UPDATED_PASSWORD
        defaultBigScreenShouldBeFound("password.notEquals=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPasswordIsInShouldWork() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password in DEFAULT_PASSWORD or UPDATED_PASSWORD
        defaultBigScreenShouldBeFound("password.in=" + DEFAULT_PASSWORD + "," + UPDATED_PASSWORD);

        // Get all the bigScreenList where password equals to UPDATED_PASSWORD
        defaultBigScreenShouldNotBeFound("password.in=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPasswordIsNullOrNotNull() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password is not null
        defaultBigScreenShouldBeFound("password.specified=true");

        // Get all the bigScreenList where password is null
        defaultBigScreenShouldNotBeFound("password.specified=false");
    }
                @Test
    @Transactional
    public void getAllBigScreensByPasswordContainsSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password contains DEFAULT_PASSWORD
        defaultBigScreenShouldBeFound("password.contains=" + DEFAULT_PASSWORD);

        // Get all the bigScreenList where password contains UPDATED_PASSWORD
        defaultBigScreenShouldNotBeFound("password.contains=" + UPDATED_PASSWORD);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPasswordNotContainsSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where password does not contain DEFAULT_PASSWORD
        defaultBigScreenShouldNotBeFound("password.doesNotContain=" + DEFAULT_PASSWORD);

        // Get all the bigScreenList where password does not contain UPDATED_PASSWORD
        defaultBigScreenShouldBeFound("password.doesNotContain=" + UPDATED_PASSWORD);
    }


    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime equals to DEFAULT_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.equals=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime equals to UPDATED_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.equals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime not equals to DEFAULT_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.notEquals=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime not equals to UPDATED_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.notEquals=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime in DEFAULT_CREATE_TIME or UPDATED_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.in=" + DEFAULT_CREATE_TIME + "," + UPDATED_CREATE_TIME);

        // Get all the bigScreenList where createTime equals to UPDATED_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.in=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime is not null
        defaultBigScreenShouldBeFound("createTime.specified=true");

        // Get all the bigScreenList where createTime is null
        defaultBigScreenShouldNotBeFound("createTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime is greater than or equal to DEFAULT_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.greaterThanOrEqual=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime is greater than or equal to UPDATED_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.greaterThanOrEqual=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime is less than or equal to DEFAULT_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.lessThanOrEqual=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime is less than or equal to SMALLER_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.lessThanOrEqual=" + SMALLER_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsLessThanSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime is less than DEFAULT_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.lessThan=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime is less than UPDATED_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.lessThan=" + UPDATED_CREATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreateTimeIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where createTime is greater than DEFAULT_CREATE_TIME
        defaultBigScreenShouldNotBeFound("createTime.greaterThan=" + DEFAULT_CREATE_TIME);

        // Get all the bigScreenList where createTime is greater than SMALLER_CREATE_TIME
        defaultBigScreenShouldBeFound("createTime.greaterThan=" + SMALLER_CREATE_TIME);
    }


    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime equals to DEFAULT_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.equals=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime equals to UPDATED_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.equals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime not equals to DEFAULT_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.notEquals=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime not equals to UPDATED_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.notEquals=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsInShouldWork() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime in DEFAULT_UPDATE_TIME or UPDATED_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.in=" + DEFAULT_UPDATE_TIME + "," + UPDATED_UPDATE_TIME);

        // Get all the bigScreenList where updateTime equals to UPDATED_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.in=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsNullOrNotNull() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime is not null
        defaultBigScreenShouldBeFound("updateTime.specified=true");

        // Get all the bigScreenList where updateTime is null
        defaultBigScreenShouldNotBeFound("updateTime.specified=false");
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsGreaterThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime is greater than or equal to DEFAULT_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.greaterThanOrEqual=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime is greater than or equal to UPDATED_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.greaterThanOrEqual=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsLessThanOrEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime is less than or equal to DEFAULT_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.lessThanOrEqual=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime is less than or equal to SMALLER_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.lessThanOrEqual=" + SMALLER_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsLessThanSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime is less than DEFAULT_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.lessThan=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime is less than UPDATED_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.lessThan=" + UPDATED_UPDATE_TIME);
    }

    @Test
    @Transactional
    public void getAllBigScreensByUpdateTimeIsGreaterThanSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where updateTime is greater than DEFAULT_UPDATE_TIME
        defaultBigScreenShouldNotBeFound("updateTime.greaterThan=" + DEFAULT_UPDATE_TIME);

        // Get all the bigScreenList where updateTime is greater than SMALLER_UPDATE_TIME
        defaultBigScreenShouldBeFound("updateTime.greaterThan=" + SMALLER_UPDATE_TIME);
    }


    @Test
    @Transactional
    public void getAllBigScreensByPublishedIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where published equals to DEFAULT_PUBLISHED
        defaultBigScreenShouldBeFound("published.equals=" + DEFAULT_PUBLISHED);

        // Get all the bigScreenList where published equals to UPDATED_PUBLISHED
        defaultBigScreenShouldNotBeFound("published.equals=" + UPDATED_PUBLISHED);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPublishedIsNotEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where published not equals to DEFAULT_PUBLISHED
        defaultBigScreenShouldNotBeFound("published.notEquals=" + DEFAULT_PUBLISHED);

        // Get all the bigScreenList where published not equals to UPDATED_PUBLISHED
        defaultBigScreenShouldBeFound("published.notEquals=" + UPDATED_PUBLISHED);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPublishedIsInShouldWork() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where published in DEFAULT_PUBLISHED or UPDATED_PUBLISHED
        defaultBigScreenShouldBeFound("published.in=" + DEFAULT_PUBLISHED + "," + UPDATED_PUBLISHED);

        // Get all the bigScreenList where published equals to UPDATED_PUBLISHED
        defaultBigScreenShouldNotBeFound("published.in=" + UPDATED_PUBLISHED);
    }

    @Test
    @Transactional
    public void getAllBigScreensByPublishedIsNullOrNotNull() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        // Get all the bigScreenList where published is not null
        defaultBigScreenShouldBeFound("published.specified=true");

        // Get all the bigScreenList where published is null
        defaultBigScreenShouldNotBeFound("published.specified=false");
    }

    @Test
    @Transactional
    public void getAllBigScreensByCreatorIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        User creator = UserResourceIT.createEntity(<% if (ormTool !== 'mybatis') { %>em<% } %>);
        <%_ if (ormTool === 'hibernate') { _%>
        em.persist(creator);
        em.flush();
        <%_ } _%>
        bigScreen.setCreator(creator);
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        Long creatorId = creator.getId();

        // Get all the bigScreenList where creator equals to creatorId
        defaultBigScreenShouldBeFound("creatorId.equals=" + creatorId);

        // Get all the bigScreenList where creator equals to creatorId + 1
        defaultBigScreenShouldNotBeFound("creatorId.equals=" + (creatorId + 1));
    }


    @Test
    @Transactional
    public void getAllBigScreensByModifierIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        User modifier = UserResourceIT.createEntity(<% if (ormTool !== 'mybatis') { %>em<% } %>);
        <%_ if (ormTool === 'hibernate') { _%>
        em.persist(modifier);
        em.flush();
        <%_ } _%>
        bigScreen.setModifier(modifier);
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        Long modifierId = modifier.getId();

        // Get all the bigScreenList where modifier equals to modifierId
        defaultBigScreenShouldBeFound("modifierId.equals=" + modifierId);

        // Get all the bigScreenList where modifier equals to modifierId + 1
        defaultBigScreenShouldNotBeFound("modifierId.equals=" + (modifierId + 1));
    }


    @Test
    @Transactional
    public void getAllBigScreensByDepartmentIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        Department department = DepartmentResourceIT.createEntity(<% if (ormTool !== 'mybatis') { %>em<% } %>);
        <%_ if (ormTool === 'hibernate') { _%>
        em.persist(department);
        em.flush();
        <%_ } _%>
        bigScreen.setDepartment(department);
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        Long departmentId = department.getId();

        // Get all the bigScreenList where department equals to departmentId
        defaultBigScreenShouldBeFound("departmentId.equals=" + departmentId);

        // Get all the bigScreenList where department equals to departmentId + 1
        defaultBigScreenShouldNotBeFound("departmentId.equals=" + (departmentId + 1));
    }


    @Test
    @Transactional
    public void getAllBigScreensByCategoryIsEqualToSomething() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        BigScreenCategory category = BigScreenCategoryResourceIT.createEntity(<% if (ormTool !== 'mybatis') { %>em<% } %>);
        <%_ if (ormTool === 'hibernate') { _%>
        em.persist(category);
        em.flush();
        <%_ } _%>
        bigScreen.setCategory(category);
        bigScreenRepository.<%= saveMethodName%>(bigScreen);
        Long categoryId = category.getId();

        // Get all the bigScreenList where category equals to categoryId
        defaultBigScreenShouldBeFound("categoryId.equals=" + categoryId);

        // Get all the bigScreenList where category equals to categoryId + 1
        defaultBigScreenShouldNotBeFound("categoryId.equals=" + (categoryId + 1));
    }

    /**
     * Executes the search, and checks that the default entity is returned.
     */
    private void defaultBigScreenShouldBeFound(String filter) throws Exception {
        restBigScreenMockMvc.perform(get("/api/big-screens?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$.[*].id").value(hasItem(bigScreen.getId().intValue())))
            .andExpect(jsonPath("$.[*].title").value(hasItem(DEFAULT_TITLE)))
            .andExpect(jsonPath("$.[*].backgroundUrl").value(hasItem(DEFAULT_BACKGROUND_URL.toString())))
            .andExpect(jsonPath("$.[*].password").value(hasItem(DEFAULT_PASSWORD)))
            .andExpect(jsonPath("$.[*].createTime").value(hasItem(sameInstant(DEFAULT_CREATE_TIME))))
            .andExpect(jsonPath("$.[*].updateTime").value(hasItem(sameInstant(DEFAULT_UPDATE_TIME))))
            .andExpect(jsonPath("$.[*].published").value(hasItem(DEFAULT_PUBLISHED.booleanValue())));

        // Check, that the count call also returns 1
        restBigScreenMockMvc.perform(get("/api/big-screens/count?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(content().string("1"));
    }

    /**
     * Executes the search, and checks that the default entity is not returned.
     */
    private void defaultBigScreenShouldNotBeFound(String filter) throws Exception {
        restBigScreenMockMvc.perform(get("/api/big-screens?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(jsonPath("$").isArray())
            .andExpect(jsonPath("$").isEmpty());

        // Check, that the count call also returns 0
        restBigScreenMockMvc.perform(get("/api/big-screens/count?sort=id,desc&" + filter))
            .andExpect(status().isOk())
            .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
            .andExpect(content().string("0"));
    }


    @Test
    @Transactional
    public void getNonExistingBigScreen() throws Exception {
        // Get the bigScreen
        restBigScreenMockMvc.perform(get("/api/big-screens/{id}", Long.MAX_VALUE))
            .andExpect(status().isNotFound());
    }

    @Test
    @Transactional
    public void updateBigScreen() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        int databaseSizeBeforeUpdate = bigScreenRepository.findAll().size();

        // Update the bigScreen
        BigScreen updatedBigScreen = bigScreenRepository.findById(bigScreen.getId()).get();
        // Disconnect from session so that the updates on updatedBigScreen are not directly saved in db
        <%_ if (ormTool !== 'mybatis') { _%>
        em.detach(updatedBigScreen);
        <%_ } _%>
        updatedBigScreen
            .title(UPDATED_TITLE)
            .backgroundUrl(UPDATED_BACKGROUND_URL)
            .password(UPDATED_PASSWORD)
            .createTime(UPDATED_CREATE_TIME)
            .updateTime(UPDATED_UPDATE_TIME)
            .published(UPDATED_PUBLISHED);
        BigScreenDTO bigScreenDTO = bigScreenMapper.toDto(updatedBigScreen);

        restBigScreenMockMvc.perform(put("/api/big-screens")
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(bigScreenDTO)))
            .andExpect(status().isOk());

        // Validate the BigScreen in the database
        List<BigScreen> bigScreenList = bigScreenRepository.findAll();
        assertThat(bigScreenList).hasSize(databaseSizeBeforeUpdate);
        BigScreen testBigScreen = bigScreenList.get(bigScreenList.size() - 1);
        assertThat(testBigScreen.getTitle()).isEqualTo(UPDATED_TITLE);
        assertThat(testBigScreen.getBackgroundUrl()).isEqualTo(UPDATED_BACKGROUND_URL);
        assertThat(testBigScreen.getPassword()).isEqualTo(UPDATED_PASSWORD);
        assertThat(testBigScreen.getCreateTime()).isEqualTo(UPDATED_CREATE_TIME);
        assertThat(testBigScreen.getUpdateTime()).isEqualTo(UPDATED_UPDATE_TIME);
        assertThat(testBigScreen.getPublished()).isEqualTo(UPDATED_PUBLISHED);
    }

    @Test
    @Transactional
    public void updateNonExistingBigScreen() throws Exception {
        int databaseSizeBeforeUpdate = bigScreenRepository.findAll().size();

        // Create the BigScreen
        BigScreenDTO bigScreenDTO = bigScreenMapper.toDto(bigScreen);

        // If the entity doesn't have an ID, it will throw BadRequestAlertException
        restBigScreenMockMvc.perform(put("/api/big-screens")
            .contentType(MediaType.APPLICATION_JSON)
            .content(TestUtil.convertObjectToJsonBytes(bigScreenDTO)))
            .andExpect(status().isBadRequest());

        // Validate the BigScreen in the database
        List<BigScreen> bigScreenList = bigScreenRepository.findAll();
        assertThat(bigScreenList).hasSize(databaseSizeBeforeUpdate);
    }

    @Test
    @Transactional
    public void deleteBigScreen() throws Exception {
        // Initialize the database
        bigScreenRepository.<%= saveMethodName%>(bigScreen);

        int databaseSizeBeforeDelete = bigScreenRepository.findAll().size();

        // Delete the bigScreen
        restBigScreenMockMvc.perform(delete("/api/big-screens/{id}", bigScreen.getId())
            .accept(MediaType.APPLICATION_JSON))
            .andExpect(status().isNoContent());

        // Validate the database contains one less item
        List<BigScreen> bigScreenList = bigScreenRepository.findAll();
        assertThat(bigScreenList).hasSize(databaseSizeBeforeDelete - 1);
    }
}
