package net.apnic.db.whois.update;

import net.apnic.db.whois.common.IntegrationTest;
import net.apnic.db.whois.update.handler.validator.domain.DsRdataAuthorisationValidator;
import net.ripe.db.whois.common.profiles.WhoisVariant;
import net.apnic.db.whois.update.authentication.strategy.AutnumAuthentication;
import net.ripe.db.whois.update.dao.AbstractDaoTest;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.ExpectedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.util.StringUtils;

import javax.sql.DataSource;

import static org.junit.Assert.assertNotNull;

@Category(IntegrationTest.class)
public class UpdateTestIntegration extends AbstractDaoTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(UpdateTestIntegration.class);

    @Rule public ExpectedException exception = ExpectedException.none();

    @Autowired @Qualifier("sourceAwareDataSource") DataSource dataSource;

    @BeforeClass
    public static void beforeClass() throws Exception {
        WhoisVariant.setWhoIsVariant(WhoisVariant.Type.APNIC);
        LOGGER.info("Setting whois variant [" + WhoisVariant.getWhoIsVariant() + "]");
    }

    @Test
    public void see_if_server_starts_and_expected_bean_present_test() throws Exception {
        DsRdataAuthorisationValidator dsRdataAuthorisationValidator = (DsRdataAuthorisationValidator)applicationContext.getBean(StringUtils.uncapitalize(DsRdataAuthorisationValidator.class.getSimpleName()));
        assertNotNull(dsRdataAuthorisationValidator);
        exception.expect(ClassCastException.class);
        AutnumAuthentication autnumAuthentication = (AutnumAuthentication)applicationContext.getBean(StringUtils.uncapitalize(AutnumAuthentication.class.getSimpleName()));
    }

    @AfterClass
    public static void afterClass() {
        WhoisVariant.setWhoIsVariant(WhoisVariant.Type.NONE);
        LOGGER.info("Unsetting whois variant [" + WhoisVariant.getWhoIsVariant() + "]");
    }
}

@@ -1125,82 +1125,8 @@
 );%0A%0A
-    @Rule public ExpectedException exception = ExpectedException.none();%0A%0A
     
@@ -1791,60 +1791,8 @@
 r);%0A
-        exception.expect(ClassCastException.class);%0A
     
@@ -1959,25 +1959,71 @@
 me()));%0A    
-%7D
+    assertNotNull(autnumAuthentication);%0A    %7D%0A
 %0A%0A    @After

Fix test