cz.muni.fi.editor.test.service.organization.OrganizationServiceIT.java Source code

Java tutorial

Introduction

Here is the source code for cz.muni.fi.editor.test.service.organization.OrganizationServiceIT.java

Source

/*
*Copyright  2016 Dominik Szalai (emptulik@gmail.com)
*
*Licensed under the Apache License, Version 2.0 (the "License");
*you may not use this file except in compliance with the License.
*You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
*Unless required by applicable law or agreed to in writing, software
*distributed under the License is distributed on an "AS IS" BASIS,
*WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*See the License for the specific language governing permissions and
*limitations under the License.
*/
/*
 * Copyright  2016 Dominik Szalai (emptulik@gmail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cz.muni.fi.editor.test.service.organization;

import cz.muni.fi.editor.api.OrganizationService;
import cz.muni.fi.editor.api.UserService;
import cz.muni.fi.editor.test.service.support.other.NotificationCheckService;
import io.github.benas.randombeans.api.EnhancedRandom;
import lombok.extern.log4j.Log4j2;
import org.hamcrest.CoreMatchers;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

import static org.awaitility.Awaitility.await;

/**
 * Created by Dominik Szalai - emptulik at gmail.com on 8.8.2016.
 */
@Log4j2
public class OrganizationServiceIT {
    @Autowired
    protected NotificationCheckService notificationCheckService;
    @Autowired
    protected OrganizationService organizationService;
    @Autowired
    protected UserService userService;
    @Autowired
    protected EnhancedRandom enhancedRandom;

    protected void waitForNotification(Callable<Integer> callable, Integer number) {
        await().atMost(3, TimeUnit.SECONDS).until(callable, CoreMatchers.equalTo(number));
    }
}