SimpleName:IDENTIFIER 58 expected expected

SimpleName:IDENTIFIER 58 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 59 invalidGetAssignmentGroupIncludes invalidGetAssignmentGroupIncludes

SimpleName:IDENTIFIER 59 Exception Exception

SimpleName:IDENTIFIER 60 GetAssignmentGroupOptions GetAssignmentGroupOptions

SimpleName:IDENTIFIER 60 courseId courseId

SimpleName:IDENTIFIER 60 includes includes

SimpleName:IDENTIFIER 60 Include Include

@Test(expected = IllegalArgumentException.class)
public void invalidGetAssignmentGroupIncludes() throws Exception {
    new GetAssignmentGroupOptions(courseId, 123L).includes(Arrays.asList(GetAssignmentGroupOptions.Include.ASSIGNMENT_VISIBILITY));
}

package edu.ksu.canvas.tests.assignment;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import edu.ksu.canvas.CanvasTestBase;
import edu.ksu.canvas.impl.AssignmentGroupImpl;
import edu.ksu.canvas.interfaces.AssignmentGroupReader;
import edu.ksu.canvas.model.assignment.AssignmentGroup;
import edu.ksu.canvas.net.FakeRestClient;
import edu.ksu.canvas.requestOptions.GetAssignmentGroupOptions;
import edu.ksu.canvas.requestOptions.ListAssignmentGroupOptions;
import static org.junit.Assert.*;

public class adhoc_AssignmentGroupUTest extends CanvasTestBase {

    private final static String courseId = "123456";

    private final static Long assignmentGroupId = 123L;

    @Autowired
    private FakeRestClient fakeRestClient;

    private AssignmentGroupReader reader;

    @Before
    public void setupData() {
        reader = new AssignmentGroupImpl(baseUrl, apiVersion, SOME_OAUTH_TOKEN, fakeRestClient, SOME_CONNECT_TIMEOUT, SOME_READ_TIMEOUT, DEFAULT_PAGINATION_PAGE_SIZE, false);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 55 expected expected

SimpleName:IDENTIFIER 55 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 56 testServletForNullName testServletForNullName

SimpleName:IDENTIFIER 57 Servlet Servlet

@Test(expected = IllegalArgumentException.class)
public void testServletForNullName() {
    new Servlet(null, TEST_CONTEXT_ROOT);
}

package org.jboss.arquillian.container.spi.client.protocol.metadata;

import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

public class adhoc_ServletTest {

    private static final String TEST_SERVLET_NAME = "jsp";

    private static final String TEST_CONTEXT_ROOT = "/test";

    private static final String ROOT_CONTEXT_ROOT_BASE_URI = Servlet.HTTP_SCHEME + HTTPContextTest.TEST_HOST + ":" + HTTPContextTest.TEST_PORT + "/";

    private static final String TEST_CONTEXT_ROOT_BASE_URI = ROOT_CONTEXT_ROOT_BASE_URI + TEST_CONTEXT_ROOT + "/";

    private static final HTTPContext TEST_HTTP_CONTEXT = new HTTPContext(HTTPContextTest.TEST_HOST, HTTPContextTest.TEST_PORT);

    private static Servlet servlet;

    private static Servlet servletWithParent;

    private static Servlet rootContextServletWithParent;

    @BeforeClass
    public static void before() {
        servlet = new Servlet(TEST_SERVLET_NAME, TEST_CONTEXT_ROOT);
        servletWithParent = new Servlet(TEST_SERVLET_NAME, TEST_CONTEXT_ROOT);
        servletWithParent.setParent(TEST_HTTP_CONTEXT);
        rootContextServletWithParent = new Servlet(TEST_SERVLET_NAME, Servlet.ROOT_CONTEXT);
        rootContextServletWithParent.setParent(TEST_HTTP_CONTEXT);
    }

    private void failOnUnexpectedException(Exception e) {
        fail(e.getClass().getSimpleName() + " was not expected: " + e.getMessage());
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 60 expected expected

SimpleName:IDENTIFIER 60 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 61 testServletForNullContextRoot testServletForNullContextRoot

SimpleName:IDENTIFIER 62 Servlet Servlet

@Test(expected = IllegalArgumentException.class)
public void testServletForNullContextRoot() {
    new Servlet(TEST_SERVLET_NAME, null);
}


SimpleName:IDENTIFIER 97 expected expected

SimpleName:IDENTIFIER 97 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 98 Exception Exception

SimpleName:IDENTIFIER 100 createDescriptor createDescriptor

SimpleName:IDENTIFIER 101 Exception Exception

SimpleName:IDENTIFIER 102 assertTrue assertTrue

StringLiteralExpr:LITERAL
102
"Verify thrown exception"
"Verify thrown exception"

SimpleName:IDENTIFIER 102 getMessage getMessage

SimpleName:IDENTIFIER 102 contains contains

StringLiteralExpr:LITERAL
102
"Defined default protocol"
"Defined default protocol"

@Test(expected = IllegalStateException.class)
public void shouldThrowExceptionIfDefaultDefinedProtocolNotFound() throws Exception {
    try {
        fire(createDescriptor("DOES_NOT_EXIST"));
    } catch (Exception e) {
        Assert.assertTrue("Verify thrown exception", e.getMessage().contains("Defined default protocol"));
        throw e;
    }
}

package org.jboss.arquillian.container.test.impl.client.protocol;

import java.util.Collections;
import java.util.List;
import org.jboss.arquillian.config.descriptor.api.ArquillianDescriptor;
import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription;
import org.jboss.arquillian.container.test.impl.domain.ProtocolDefinition;
import org.jboss.arquillian.container.test.impl.domain.ProtocolRegistry;
import org.jboss.arquillian.container.test.spi.client.protocol.Protocol;
import org.jboss.arquillian.container.test.test.AbstractContainerTestTestBase;
import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
import org.jboss.arquillian.core.spi.ServiceLoader;
import org.jboss.arquillian.core.spi.context.ApplicationContext;
import org.jboss.shrinkwrap.descriptor.api.Descriptors;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_ProtocolRegistryCreatorTestCase extends AbstractContainerTestTestBase {

    @Mock
    private ServiceLoader serviceLoader;

    @Mock
    private Protocol<?> protocol;

    @Override
    protected void addExtensions(List<Class<?>> extensions) {
        extensions.add(ProtocolRegistryCreator.class);
    }

    @Before
    public void setup() throws Exception {
        bind(ApplicationScoped.class, ServiceLoader.class, serviceLoader);
    }

    private ProtocolDefinition verifyRegistryProtocol(String protocolName) {
        ProtocolRegistry registry = getManager().resolve(ProtocolRegistry.class);
        ProtocolDefinition registeredProtocol = registry.getProtocol(new ProtocolDescription(protocolName));
        Assert.assertNotNull("Verify " + Protocol.class.getSimpleName() + " was registered", registeredProtocol);
        Assert.assertEquals("Verify same protocol instance was registered", protocol, registeredProtocol.getProtocol());
        return registeredProtocol;
    }

    private ArquillianDescriptor createDescriptor() {
        return createDescriptor(null);
    }

    private ArquillianDescriptor createDescriptor(String defaultProtocol) {
        ArquillianDescriptor desc = Descriptors.create(ArquillianDescriptor.class);
        if (defaultProtocol != null) {
            desc.defaultProtocol(defaultProtocol);
        }
        return desc;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 181 expected expected

SimpleName:IDENTIFIER 181 RuntimeException RuntimeException

SimpleName:IDENTIFIER 182 Exception Exception

SimpleName:IDENTIFIER 183 TestExceptionDeployThrower TestExceptionDeployThrower

SimpleName:IDENTIFIER 183 shouldThrow shouldThrow

SimpleName:IDENTIFIER 185 DeployDeployment DeployDeployment

SimpleName:IDENTIFIER 186 container container

SimpleName:IDENTIFIER 187 Deployment Deployment

SimpleName:IDENTIFIER 187 DeploymentDescription DeploymentDescription

StringLiteralExpr:LITERAL 187 "test" "test"

SimpleName:IDENTIFIER 187 ShrinkWrap ShrinkWrap

SimpleName:IDENTIFIER 187 JavaArchive JavaArchive

SimpleName:IDENTIFIER 188 setExpectedException setExpectedException

SimpleName:IDENTIFIER 188 IllegalArgumentException IllegalArgumentException

@Test(expected = RuntimeException.class)
public void shouldThrowExceptionIfExpectedButNoExceptionThrown() throws Exception {
    TestExceptionDeployThrower.shouldThrow = null;
    fire(new DeployDeployment(container, new Deployment(new DeploymentDescription("test", ShrinkWrap.create(JavaArchive.class)).setExpectedException(IllegalArgumentException.class))));
}

package org.jboss.arquillian.container.impl.client.container;

import java.util.Collections;
import java.util.List;
import org.jboss.arquillian.container.spi.Container;
import org.jboss.arquillian.container.spi.client.container.DeploymentException;
import org.jboss.arquillian.container.spi.client.container.DeploymentExceptionTransformer;
import org.jboss.arquillian.container.spi.client.deployment.Deployment;
import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription;
import org.jboss.arquillian.container.spi.event.DeployDeployment;
import org.jboss.arquillian.container.test.AbstractContainerTestBase;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.arquillian.core.spi.ServiceLoader;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class adhoc_DeploymentExceptionHandlerTestCase extends AbstractContainerTestBase {

    @Inject
    @ApplicationScoped
    private InstanceProducer<ServiceLoader> serviceProducer;

    @Mock
    private ServiceLoader serviceLoader;

    @Mock
    private DeploymentExceptionTransformer transformer;

    @Mock
    private Container container;

    @Override
    protected void addExtensions(List<Class<?>> extensions) {
        extensions.add(DeploymentExceptionHandler.class);
        extensions.add(TestExceptionDeployThrower.class);
    }

    @Before
    public void registerServiceLoader() {
        serviceProducer.set(serviceLoader);
    }

    private static class MyDeploymentException extends Exception {

        private static final long serialVersionUID = 4864115564504690695L;

        private DeploymentException deploymentException;

        public MyDeploymentException(String message, Throwable cause) {
            super(message);
            this.deploymentException = new DeploymentException("Could not deploy", cause);
        }

        public DeploymentException getDeploymentException() {
            return deploymentException;
        }
    }

    public static class TestExceptionDeployThrower {

        public static Throwable shouldThrow = null;

        public void throwException(@Observes DeployDeployment event) throws Throwable {
            if (shouldThrow != null) {
                throw shouldThrow;
            }
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 89 expected expected

SimpleName:IDENTIFIER 89 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 90 Exception Exception

SimpleName:IDENTIFIER 91 registry registry

SimpleName:IDENTIFIER 91 ServiceRegistry ServiceRegistry

SimpleName:IDENTIFIER 91 injector injector

SimpleName:IDENTIFIER 91 LinkedHashMap LinkedHashMap

SimpleName:IDENTIFIER 92 registry registry

SimpleName:IDENTIFIER 92 addService addService

SimpleName:IDENTIFIER 92 FakeService FakeService

SimpleName:IDENTIFIER 92 ShouldBeIncluded ShouldBeIncluded

SimpleName:IDENTIFIER 93 registry registry

SimpleName:IDENTIFIER 93 addService addService

SimpleName:IDENTIFIER 93 FakeService FakeService

SimpleName:IDENTIFIER 93 ShouldBeExcluded ShouldBeExcluded

SimpleName:IDENTIFIER 96 registry registry

SimpleName:IDENTIFIER 96 getServiceLoader getServiceLoader

SimpleName:IDENTIFIER 96 onlyOne onlyOne

SimpleName:IDENTIFIER 96 FakeService FakeService

@Test(expected = IllegalStateException.class)
public void shouldThrowExceptionIfMultipleFoundWhenTryingOnlyOne() throws Exception {
    ServiceRegistry registry = new ServiceRegistry(injector.get(), new LinkedHashMap<Class<?>, Set<Class<?>>>());
    registry.addService(FakeService.class, ShouldBeIncluded.class);
    registry.addService(FakeService.class, ShouldBeExcluded.class);
    registry.getServiceLoader().onlyOne(FakeService.class);
}

package org.jboss.arquillian.core.impl.loadable;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Set;
import org.jboss.arquillian.core.api.Injector;
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.impl.loadable.util.FakeService;
import org.jboss.arquillian.core.impl.loadable.util.ShouldBeExcluded;
import org.jboss.arquillian.core.impl.loadable.util.ShouldBeIncluded;
import org.jboss.arquillian.core.test.AbstractManagerTestBase;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_ServiceRegistryLoaderTestCase extends AbstractManagerTestBase {

    @Inject
    private Instance<Injector> injector;
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 129 expected expected

SimpleName:IDENTIFIER 129 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 130 Exception Exception

SimpleName:IDENTIFIER 131 manager manager

SimpleName:IDENTIFIER 131 ManagerImpl ManagerImpl

SimpleName:IDENTIFIER 131 ManagerBuilder ManagerBuilder

SimpleName:IDENTIFIER 132 manager manager

SimpleName:IDENTIFIER 132 ManagerTestScoped ManagerTestScoped

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionOnBindWithNoFoundScopedContext() throws Exception {
    ManagerImpl manager = (ManagerImpl) ManagerBuilder.from().create();
    manager.bind(ManagerTestScoped.class, Object.class, new Object());
}

package org.jboss.arquillian.core.impl;

import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.arquillian.core.spi.ManagerBuilder;
import org.jboss.arquillian.core.spi.NonManagedObserver;
import org.jboss.arquillian.core.spi.context.ApplicationContext;
import org.jboss.arquillian.core.test.context.ManagerTest2Context;
import org.jboss.arquillian.core.test.context.ManagerTest2ContextImpl;
import org.jboss.arquillian.core.test.context.ManagerTestContext;
import org.jboss.arquillian.core.test.context.ManagerTestContextImpl;
import org.jboss.arquillian.core.test.context.ManagerTestScoped;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_ManagerImplTestCase {

    private static class TestExtension {

        private boolean wasCalled = false;

        @Inject
        private Instance<Object> value;

        @SuppressWarnings("unused")
        public void on(@Observes String object) {
            Assert.assertNotNull("Verify event is not null", object);
            Assert.assertNotNull("Verify InjectionPoint is not null", value);
            Assert.assertNotNull("Verify InjectionPoint value is not null", value.get());
            wasCalled = true;
        }
    }

    private static class TestNonManagedObserver implements NonManagedObserver<String> {

        private static String firedEvent = null;

        @Inject
        private Instance<ApplicationContext> applicationContext;

        @Override
        public void fired(String event) {
            firedEvent = event;
            if (applicationContext == null) {
                throw new IllegalStateException("ApplicationContext should have been injected, but was null");
            }
        }
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 135 expected expected

SimpleName:IDENTIFIER 135 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 136 Exception Exception

SimpleName:IDENTIFIER 137 manager manager

SimpleName:IDENTIFIER 137 ManagerImpl ManagerImpl

SimpleName:IDENTIFIER 137 ManagerBuilder ManagerBuilder

SimpleName:IDENTIFIER 138 context context

SimpleName:IDENTIFIER 138 ManagerTestContextImpl ManagerTestContextImpl

SimpleName:IDENTIFIER 140 manager manager

SimpleName:IDENTIFIER 140 ManagerTestScoped ManagerTestScoped

@Test(expected = IllegalArgumentException.class)
public void shouldThrowExceptionOnBindWithNonActiveScopedContext() throws Exception {
    ManagerImpl manager = (ManagerImpl) ManagerBuilder.from().context(ManagerTestContextImpl.class).create();
    manager.bind(ManagerTestScoped.class, Object.class, new Object());
}


SimpleName:IDENTIFIER 78 expected expected

SimpleName:IDENTIFIER 78 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 79 Exception Exception

SimpleName:IDENTIFIER 80 manager manager

SimpleName:IDENTIFIER 80 ManagerImpl ManagerImpl

SimpleName:IDENTIFIER 80 ManagerBuilder ManagerBuilder

SimpleName:IDENTIFIER 81 instance instance

SimpleName:IDENTIFIER 81 InstanceImpl InstanceImpl

SimpleName:IDENTIFIER 81 manager manager

SimpleName:IDENTIFIER 83 instance instance

StringLiteralExpr:LITERAL
84
"Should have thrown "
"Should have thrown "

SimpleName:IDENTIFIER 84 IllegalStateException IllegalStateException

@Test(expected = IllegalStateException.class)
public void shouldThrowExceptionIfTryingToSetAUnScopedInstance() throws Exception {
    ManagerImpl manager = (ManagerImpl) ManagerBuilder.from().create();
    InstanceProducer<Object> instance = InstanceImpl.of(Object.class, null, manager);
    instance.set(new Object());
    Assert.fail("Should have thrown " + IllegalStateException.class);
}

package org.jboss.arquillian.core.impl;

import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.arquillian.core.spi.ManagerBuilder;
import org.jboss.arquillian.core.test.context.ManagerTestContext;
import org.jboss.arquillian.core.test.context.ManagerTestContextImpl;
import org.jboss.arquillian.core.test.context.ManagerTestScoped;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_InstanceImplTestCase {

    private static class TestObserver {

        private boolean wasCalled = false;

        @SuppressWarnings("unused")
        public void shouldBeCalled(@Observes Object object) {
            Assert.assertNotNull(object);
            wasCalled = true;
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 16 testUnsupportedTypeFailureAvailability testUnsupportedTypeFailureAvailability

SimpleName:IDENTIFIER 17 ConfigurationSourceKey ConfigurationSourceKey

SimpleName:IDENTIFIER 17 FIXTURE FIXTURE

StringLiteralExpr:LITERAL 17 "fixture" "fixture"

SimpleName:IDENTIFIER 19 ConfigurationSourceRegistry ConfigurationSourceRegistry

SimpleName:IDENTIFIER 19 INSTANCE INSTANCE

SimpleName:IDENTIFIER 19 isConfigurationAvailable isConfigurationAvailable

"ConfigurationSourceRegistry should have thrown an exception"

@Test
public void testUnsupportedTypeFailureAvailability() {
    ConfigurationSourceKey key = new ConfigurationSourceKey(Type.FIXTURE, Format.JSON, "fixture");
    ConfigurationSourceRegistry.INSTANCE.isConfigurationAvailable(key);
}

@Test(expected = IllegalArgumentException.class)
public void testUnsupportedTypeFailureAvailability() {
    ConfigurationSourceKey key = new ConfigurationSourceKey(Type.FIXTURE, Format.JSON, "fixture");
    ConfigurationSourceRegistry.INSTANCE.isConfigurationAvailable(key);
}

package org.configureme.sources;

import org.configureme.sources.ConfigurationSourceKey.Format;
import org.configureme.sources.ConfigurationSourceKey.Type;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_ConfigurationSourceRegistryAddTest {

    @BeforeClass
    public static void resetSourceRegistry() {
        ConfigurationSourceRegistry.INSTANCE.reset();
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 26 expected expected

SimpleName:IDENTIFIER 26 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 26 testUnsupportedTypeFailureLoading testUnsupportedTypeFailureLoading

SimpleName:IDENTIFIER 27 ConfigurationSourceKey ConfigurationSourceKey

SimpleName:IDENTIFIER 27 FIXTURE FIXTURE

StringLiteralExpr:LITERAL 27 "fixture" "fixture"

SimpleName:IDENTIFIER 28 ConfigurationSourceRegistry ConfigurationSourceRegistry

SimpleName:IDENTIFIER 28 INSTANCE INSTANCE

SimpleName:IDENTIFIER 28 readConfigurationSource readConfigurationSource

@Test(expected = IllegalArgumentException.class)
public void testUnsupportedTypeFailureLoading() {
    ConfigurationSourceKey key = new ConfigurationSourceKey(Type.FIXTURE, Format.JSON, "fixture");
    ConfigurationSourceRegistry.INSTANCE.readConfigurationSource(key);
    fail("ConfigurationSourceRegistry should have thrown an exception");
}


SimpleName:IDENTIFIER 16 expected expected

SimpleName:IDENTIFIER 16 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 16 checkNonExistingFile checkNonExistingFile

SimpleName:IDENTIFIER 17 ConfigurationSourceKey ConfigurationSourceKey

StringLiteralExpr:LITERAL 17 "foo" "foo"

SimpleName:IDENTIFIER 18 FileLoader FileLoader

SimpleName:IDENTIFIER 19 assertFalse assertFalse

SimpleName:IDENTIFIER 19 isAvailable isAvailable

SimpleName:IDENTIFIER 20 getLastChangeTimestamp getLastChangeTimestamp

StringLiteralExpr:LITERAL
21
"An exception should have been thrown."
"An exception should have been thrown."

@Test(expected = IllegalArgumentException.class)
public void checkNonExistingFile() {
    ConfigurationSourceKey key = new ConfigurationSourceKey(Type.FILE, Format.JSON, "foo");
    FileLoader loader = new FileLoader();
    assertFalse(loader.isAvailable(key));
    loader.getLastChangeTimestamp(key);
    fail("An exception should have been thrown.");
}

package org.configureme.sources;

import org.configureme.sources.ConfigurationSourceKey.Format;
import org.configureme.sources.ConfigurationSourceKey.Type;
import org.junit.Test;
import static org.junit.Assert.*;

public class adhoc_FileLoaderTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 67 expected expected

SimpleName:IDENTIFIER 67 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 67 recreate recreate

SimpleName:IDENTIFIER 68 ConfigurationRepository ConfigurationRepository

SimpleName:IDENTIFIER 68 INSTANCE INSTANCE

SimpleName:IDENTIFIER 68 createArtefact createArtefact

StringLiteralExpr:LITERAL 68 "test" "test"

StringLiteralExpr:LITERAL
69
"Exception expected"
"Exception expected"

@Test(expected = IllegalArgumentException.class)
public void recreate() {
    ConfigurationRepository.INSTANCE.createArtefact("test");
    fail("Exception expected");
}

package org.configureme.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Map.Entry;
import java.util.Set;
import org.configureme.Configuration;
import org.configureme.GlobalEnvironment;
import org.junit.Before;
import org.junit.Test;

public class adhoc_ConfigurationRepositoryTest {

    @Before
    public void setupConfigObject() {
        if (ConfigurationRepository.INSTANCE.hasConfiguration("test"))
            return;
        Artefact test = ConfigurationRepository.INSTANCE.createArtefact("test");
        assertTrue(ConfigurationRepository.INSTANCE.hasConfiguration("test"));
        test.addAttributeValue("foo", new PlainValue("bar"), GlobalEnvironment.INSTANCE);
        if (ConfigurationRepository.INSTANCE.hasConfiguration("test2"))
            return;
        Artefact test2 = ConfigurationRepository.INSTANCE.createArtefact("test2");
        assertTrue(ConfigurationRepository.INSTANCE.hasConfiguration("test2"));
        test2.addAttributeValue("foo", new PlainValue("bar"), GlobalEnvironment.INSTANCE);
    }

    @Before
    public void setupLargeConfig() {
        if (ConfigurationRepository.INSTANCE.hasConfiguration("large"))
            return;
        Artefact large = ConfigurationRepository.INSTANCE.createArtefact("large");
        assertTrue(ConfigurationRepository.INSTANCE.hasConfiguration("large"));
        for (int i = 0; i < 10; i++) large.addAttributeValue("key" + i, new PlainValue("value" + i), GlobalEnvironment.INSTANCE);
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 72 expected expected

SimpleName:IDENTIFIER 72 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 72 queryNonExistent queryNonExistent

SimpleName:IDENTIFIER 73 ConfigurationRepository ConfigurationRepository

SimpleName:IDENTIFIER 73 INSTANCE INSTANCE

SimpleName:IDENTIFIER 73 getConfiguration getConfiguration

StringLiteralExpr:LITERAL 73 "foo" "foo"

SimpleName:IDENTIFIER 73 GlobalEnvironment GlobalEnvironment

StringLiteralExpr:LITERAL
74
"Exception expected"
"Exception expected"

@Test(expected = IllegalArgumentException.class)
public void queryNonExistent() {
    ConfigurationRepository.INSTANCE.getConfiguration("foo", GlobalEnvironment.INSTANCE);
    fail("Exception expected");
}


SimpleName:IDENTIFIER 14 expected expected

SimpleName:IDENTIFIER 14 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 14 testForNonExistingAttribute testForNonExistingAttribute

SimpleName:IDENTIFIER 15 Artefact Artefact

StringLiteralExpr:LITERAL 15 "foo" "foo"

SimpleName:IDENTIFIER 16 getAttribute getAttribute

StringLiteralExpr:LITERAL 16 "not-existing" "not-existing"

@Test(expected = IllegalArgumentException.class)
public void testForNonExistingAttribute() {
    Artefact toTest = new Artefact("foo");
    toTest.getAttribute("not-existing");
}

package org.configureme.repository;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class adhoc_ArtefactTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 30 expected expected

SimpleName:IDENTIFIER 30 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 30 configureNotConfigurableAsWithKey configureNotConfigurableAsWithKey

SimpleName:IDENTIFIER 32 ConfigurationManager ConfigurationManager

SimpleName:IDENTIFIER 32 INSTANCE INSTANCE

SimpleName:IDENTIFIER 32 configureAs configureAs

SimpleName:IDENTIFIER 32 GlobalEnvironment GlobalEnvironment

StringLiteralExpr:LITERAL
33
"exception should been thrown"
"exception should been thrown"

@Test(expected = IllegalArgumentException.class)
public void configureNotConfigurableAsWithKey() {
    Object foo = new Object();
    ConfigurationManager.INSTANCE.configureAs(foo, GlobalEnvironment.INSTANCE, null);
    fail("exception should been thrown");
}

package org.configureme;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Date;
import org.configureme.annotations.BeforeConfiguration;
import org.configureme.annotations.Configure;
import org.configureme.annotations.ConfigureMe;
import org.configureme.annotations.Set;
import org.configureme.annotations.SetAll;
import org.configureme.annotations.SetIf;
import org.configureme.annotations.SetIf.SetIfCondition;
import org.configureme.sources.ConfigurationSourceKey.Format;
import org.junit.Test;

public class adhoc_TestForErrors {

    @ConfigureMe
    private class FooConfig {
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithBrokenAnnotation {

        @BeforeConfiguration
        public void methodWithWrongNumberOfAttributes(String foo) {
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithHiddenAnnotation {

        {
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithErrorAnnotation {

        @BeforeConfiguration
        public void methodWithWrongVisibility() {
            throw new RuntimeException("Hello world!");
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithUnsupportedAttribute {

        private boolean calledSetInt = false;

        private boolean calledSetObject = false;

        @Set("intValue")
        public void setInt(int xxx) {
            calledSetInt = true;
        }

        @Set("intValue")
        public void setObject(Date xxx) {
            calledSetObject = true;
        }

        public boolean isSetDateCalled() {
            return calledSetObject;
        }

        public boolean isSetIntCalled() {
            return calledSetInt;
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithUnsupportedPublicAttribute {

        @Configure
        public int intValue = 0;

        @Configure
        public int stringValue = 0;

        public boolean isIntValueSet() {
            return intValue != 0;
        }

        public boolean isStringValueSet() {
            return stringValue != 0;
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithUnsupportedMethods {

        @Configure
        private int intValue = 0;

        @Configure
        private String stringValue = "";

        public void setIntValue() {
            throw new AssertionError("Can't be called!");
        }

        public void setStringValueXXX(String s) {
            throw new AssertionError("Method setStringValue is missing!");
        }
    }

    @ConfigureMe(name = "brokenfixture")
    private class BrokenConfig {
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithMissingMethods {

        @Configure
        private int intValue = 0;
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithExceptionsInSetMethods {

        @Configure
        private int intValue;

        @Set("intValue")
        public void aSetMethod() {
            throw new RuntimeException("Set failed");
        }

        @SetAll
        public void aSetAllMethod() {
            throw new RuntimeException("Set all failed");
        }

        public void setIntValue(int aValue) {
            throw new RuntimeException("setIntValue");
        }

        @SetIf(value = "int", condition = SetIfCondition.startsWith)
        public void aSetIfMethod() {
            throw new RuntimeException("Set if failed");
        }
    }

    @ConfigureMe(name = "fixture")
    private class ObjectWithAttributesMissingInConfig {

        @Configure
        public int missingValue = 100;

        @Override
        public String toString() {
            return "" + missingValue;
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 36 expected expected

SimpleName:IDENTIFIER 36 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 38 ConfigurationManager ConfigurationManager

SimpleName:IDENTIFIER 38 INSTANCE INSTANCE

SimpleName:IDENTIFIER 38 configureAs configureAs

SimpleName:IDENTIFIER 38 GlobalEnvironment GlobalEnvironment

StringLiteralExpr:LITERAL 38 "foo" "foo"

StringLiteralExpr:LITERAL
39
"exception should been thrown"
"exception should been thrown"

@Test(expected = IllegalArgumentException.class)
public void configureNotConfigurableAsWithNameAndFormat() {
    Object foo = new Object();
    ConfigurationManager.INSTANCE.configureAs(foo, GlobalEnvironment.INSTANCE, "foo", Format.JSON);
    fail("exception should been thrown");
}


"Using the builder after build() was called is not allowed!"

@Test
public void testBuilder_ErrorOnReUse2() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withDefaultValueStrategy(null);
}

@Test(expected = IllegalStateException.class)
public void testBuilder_ErrorOnReUse2() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withDefaultValueStrategy(null);
}

package com.btc.redg.runtime;

import com.btc.redg.runtime.defaultvalues.DefaultDefaultValueStrategy;
import com.btc.redg.runtime.defaultvalues.pluggable.PluggableDefaultValueStrategy;
import com.btc.redg.runtime.dummy.DefaultDummyFactory;
import com.btc.redg.runtime.dummy.DummyFactory;
import com.btc.redg.runtime.insertvalues.DefaultSQLValuesFormatter;
import com.btc.redg.runtime.insertvalues.SQLValuesFormatter;
import com.btc.redg.runtime.transformer.DefaultPreparedStatementParameterSetter;
import com.btc.redg.runtime.transformer.PreparedStatementParameterSetter;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.MethodRule;
import org.junit.runner.RunWith;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Vector;
import static org.junit.Assert.*;

public class adhoc_RedGBuilderTest {

    private final String redGClassData = "yv66vgAAADQAFAoABAAQCAARBwASBwATAQAGPGluaXQ+AQADKClWAQAEQ29kZQEAD0xpbmVOdW1i" + "ZXJUYWJsZQEAEkxvY2FsVmFyaWFibGVUYWJsZQEABHRoaXMBAB1MY29tL2J0Yy9yZWRnL2dlbmVy" + "YXRlZC9SZWRHOwEAFGdldFZpc3VhbGl6YXRpb25Kc29uAQAUKClMamF2YS9sYW5nL1N0cmluZzsB" + "AApTb3VyY2VGaWxlAQAJUmVkRy5qYXZhDAAFAAYBAARub3BlAQAbY29tL2J0Yy9yZWRnL2dlbmVy" + "YXRlZC9SZWRHAQAhY29tL2J0Yy9yZWRnL3J1bnRpbWUvQWJzdHJhY3RSZWRHACEAAwAEAAAAAAAC" + "AAEABQAGAAEABwAAAC8AAQABAAAABSq3AAGxAAAAAgAIAAAABgABAAAABQAJAAAADAABAAAABQAK" + "AAsAAAABAAwADQABAAcAAAAtAAEAAQAAAAMSArAAAAACAAgAAAAGAAEAAAAIAAkAAAAMAAEAAAAD" + "AAoACwAAAAEADgAAAAIADw==";

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

    public static class MyRedG extends AbstractRedG {

        @Override
        public String getVisualizationJson() {
            return "nope";
        }
    }

    public static class PrivateRedG extends AbstractRedG {

        private PrivateRedG() {
        }

        @Override
        public String getVisualizationJson() {
            return "nope";
        }
    }
    /*TEST PLACEHOLDER*/
}


@Test
public void testBuilder_ErrorOnReUse3() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withPreparedStatementParameterSetter(null);
}

@Test(expected = IllegalStateException.class)
public void testBuilder_ErrorOnReUse3() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withPreparedStatementParameterSetter(null);
}


@Test
public void testBuilder_ErrorOnReUse4() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withDummyFactory(null);
}

@Test(expected = IllegalStateException.class)
public void testBuilder_ErrorOnReUse4() {
    RedGBuilder builder = new RedGBuilder<>(MyRedG.class);
    builder.build();
    builder.withDummyFactory(null);
}


SimpleName:IDENTIFIER 50 testAppendProviderAfterUsage testAppendProviderAfterUsage

@Test
public void testAppendProviderAfterUsage() {
    MultiProviderNameProvider provider = new MultiProviderNameProvider();
    provider.getClassNameForTable(webUser);
    NameProvider extraProvider = mock(NameProvider.class);
    provider.appendProvider(extraProvider);
}

@Test(expected = UnsupportedOperationException.class)
public void testAppendProviderAfterUsage() {
    MultiProviderNameProvider provider = new MultiProviderNameProvider();
    provider.getClassNameForTable(webUser);
    NameProvider extraProvider = mock(NameProvider.class);
    provider.appendProvider(extraProvider);
}

package com.btc.redg.generator.nameprovider;

import com.btc.redg.generator.extractor.nameprovider.MultiProviderNameProvider;
import com.btc.redg.generator.extractor.nameprovider.NameProvider;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import schemacrawler.schema.Column;
import schemacrawler.schema.ForeignKey;
import schemacrawler.schema.Table;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.same;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class adhoc_MultiProviderNameProviderTest {

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

    private final Table webUser = DummyDatabaseStructureProvider.getDummyTable("WEB_USER");

    private final Table webTransactions = DummyDatabaseStructureProvider.getDummyTable("WEB_TRANSACTIONS");

    private final Column idColumn = DummyDatabaseStructureProvider.getDummyColumn("ID", null);

    private final Column nameColumn = DummyDatabaseStructureProvider.getDummyColumn("FIRST_NAME", null);

    private final ForeignKey userFk = DummyDatabaseStructureProvider.getSimpleForeignKey("CREATOR", "X", "USER");

    private final ForeignKey blogFk = DummyDatabaseStructureProvider.getMultiPartForeignKey("FK_BLOG_POST_CREATOR_USER", "User");
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 61 testPrependProviderAfterUsage testPrependProviderAfterUsage

@Test
public void testPrependProviderAfterUsage() {
    MultiProviderNameProvider provider = new MultiProviderNameProvider();
    provider.getClassNameForTable(webUser);
    NameProvider extraProvider = mock(NameProvider.class);
    provider.prependProvider(extraProvider);
}

@Test(expected = UnsupportedOperationException.class)
public void testPrependProviderAfterUsage() {
    MultiProviderNameProvider provider = new MultiProviderNameProvider();
    provider.getClassNameForTable(webUser);
    NameProvider extraProvider = mock(NameProvider.class);
    provider.prependProvider(extraProvider);
}


SimpleName:IDENTIFIER 87 expected expected

SimpleName:IDENTIFIER 87 CopierException CopierException

SimpleName:IDENTIFIER 88 converterCopyTest converterCopyTest

SimpleName:IDENTIFIER 89 teacher teacher

SimpleName:IDENTIFIER 89 newTeacher newTeacher

SimpleName:IDENTIFIER 91 converterCopier converterCopier

SimpleName:IDENTIFIER 91 teacher teacher

@Test(expected = CopierException.class)
public void converterCopyTest() {
    Teacher teacher = newTeacher();
    converterCopier.copy(teacher);
}

package com.github.trang.copiers.test.coveralls;

import static com.github.trang.copiers.test.util.MockUtils.newTeacher;
import static com.github.trang.copiers.test.util.MockUtils.newTeacherEntity;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.collect.Sets.newHashSet;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import org.junit.Test;
import com.github.trang.copiers.Copiers;
import com.github.trang.copiers.base.Copier;
import com.github.trang.copiers.exception.CopierException;
import com.github.trang.copiers.test.bean.Teacher;
import com.github.trang.copiers.test.bean.TeacherEntity;
import com.github.trang.copiers.test.plugin.TestConverter;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@SuppressWarnings("Duplicates")
public class adhoc_CglibCopierTest {

    private static Copier<Teacher, TeacherEntity> copier = Copiers.createCglib(Teacher.class, TeacherEntity.class);

    private static Copier<Teacher, TeacherEntity> converterCopier = Copiers.createCglib(Teacher.class, TeacherEntity.class, new TestConverter());

    private static Copier<TeacherEntity, Teacher> reverseCopier = Copiers.createCglib(TeacherEntity.class, Teacher.class);
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 89 shouldThrowExceptionIfKeyDoesNotExist shouldThrowExceptionIfKeyDoesNotExist

SimpleName:IDENTIFIER 89 Exception Exception

@Test
public void shouldThrowExceptionIfKeyDoesNotExist() throws Exception {
    DefaultEnvironment env = buildEnvironment(context);
    env.get("key_that_doesnt_exist");
}

@Test(expected = NoSuchElementException.class)
public void shouldThrowExceptionIfKeyDoesNotExist() throws Exception {
    DefaultEnvironment env = buildEnvironment(context);
    env.get("key_that_doesnt_exist");
}

package br.com.caelum.vraptor.environment;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.io.IOException;
import java.net.URL;
import java.util.NoSuchElementException;
import javax.servlet.ServletContext;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;

public class adhoc_DefaultEnvironmentTest {

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

    private ServletContext context;

    @Before
    public void setup() {
        context = Mockito.mock(ServletContext.class);
    }

    public void shouldGetOverridedSystemPropertyValueIfIsSet() throws IOException {
        DefaultEnvironment defaultEnvironment = buildEnvironment(EnvironmentType.DEVELOPMENT);
        System.setProperty("env_name", "customEnv");
        String value = defaultEnvironment.get("env_name");
        assertThat("customEnv", is(value));
        System.setProperty("env_name", "");
    }

    private DefaultEnvironment buildEnvironment(EnvironmentType environmentType) {
        DefaultEnvironment defaultEnvironment = new DefaultEnvironment(environmentType);
        return defaultEnvironment;
    }

    private DefaultEnvironment buildEnvironment(ServletContext context) {
        DefaultEnvironment defaultEnvironment = new DefaultEnvironment(context);
        defaultEnvironment.setup();
        return defaultEnvironment;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 116 shouldNotAcceptMethodsWithoutArguments shouldNotAcceptMethodsWithoutArguments

SimpleName:IDENTIFIER 116 Exception Exception

"Methods that consumes xml must receive just one argument"

@Test
public void shouldNotAcceptMethodsWithoutArguments() throws Exception {
    deserializer.deserialize(new ByteArrayInputStream(new byte[0]), woof);
}

@Test(expected = IllegalArgumentException.class)
public void shouldNotAcceptMethodsWithoutArguments() throws Exception {
    deserializer.deserialize(new ByteArrayInputStream(new byte[0]), woof);
}

package br.com.caelum.vraptor.serialization.xstream;

import static br.com.caelum.vraptor.serialization.xstream.XStreamBuilderImpl.cleanInstance;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import br.com.caelum.vraptor.controller.BeanClass;
import br.com.caelum.vraptor.controller.ControllerMethod;
import br.com.caelum.vraptor.controller.DefaultBeanClass;
import br.com.caelum.vraptor.controller.DefaultControllerMethod;
import br.com.caelum.vraptor.http.ParameterNameProvider;
import br.com.caelum.vraptor.http.ParanamerNameProvider;
import com.thoughtworks.xstream.annotations.XStreamAlias;

public class adhoc_XStreamXmlDeserializerTest {

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

    private XStreamXMLDeserializer deserializer;

    private ControllerMethod bark;

    private ParameterNameProvider provider;

    private ControllerMethod jump;

    private ControllerMethod woof;

    private ControllerMethod dropDead;

    private ControllerMethod annotated;

    private ControllerMethod walk;

    @Before
    public void setUp() throws Exception {
        provider = new ParanamerNameProvider();
        deserializer = new XStreamXMLDeserializer(provider, cleanInstance(new CalendarConverter()));
        BeanClass controllerClass = new DefaultBeanClass(DogController.class);
        BeanClass personControllerClass = new DefaultBeanClass(PersonController.class);
        woof = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("woof"));
        bark = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("bark", Dog.class));
        jump = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("jump", Dog.class, Integer.class));
        dropDead = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("dropDead", Integer.class, Dog.class));
        annotated = new DefaultControllerMethod(controllerClass, DogController.class.getDeclaredMethod("annotated", DogWithAnnotations.class));
        walk = new DefaultControllerMethod(personControllerClass, PersonController.class.getDeclaredMethod("walk", Person.class));
    }

    static class Person {

        private String name;

        private Dog dog;
    }

    static class PersonController {

        public void walk(Person person) {
        }
    }

    @XStreamAlias("dogAnnotated")
    static class DogWithAnnotations {

        @XStreamAlias("nameAnnotated")
        private String name;

        @XStreamAlias("ageAnnotated")
        private Integer age;
    }

    static class Dog {

        private String name;

        private Integer age;

        private Calendar birthday;
    }

    static class DogController {

        public void woof() {
        }

        public void bark(Dog dog) {
        }

        public void jump(Dog dog, Integer times) {
        }

        public void dropDead(Integer times, Dog dog) {
        }

        public void annotated(DogWithAnnotations dog) {
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 75 InterceptionException InterceptionException

SimpleName:IDENTIFIER 75 IOException IOException

@Test
public void shouldComplainWhenUnableToInstantiateAnInterceptor() throws InterceptionException, IOException {
    when(container.instanceFor(MyWeirdInterceptor.class)).thenReturn(null);
    ToInstantiateInterceptorHandler handler = new ToInstantiateInterceptorHandler(container, MyWeirdInterceptor.class, new ExecuteMethodExceptionHandler());
    handler.execute(null, null, null);
}

@Test(expected = InterceptionException.class)
public void shouldComplainWhenUnableToInstantiateAnInterceptor() throws InterceptionException, IOException {
    when(container.instanceFor(MyWeirdInterceptor.class)).thenReturn(null);
    ToInstantiateInterceptorHandler handler = new ToInstantiateInterceptorHandler(container, MyWeirdInterceptor.class, new ExecuteMethodExceptionHandler());
    handler.execute(null, null, null);
}

package br.com.caelum.vraptor.core;

import br.com.caelum.vraptor.InterceptionException;
import br.com.caelum.vraptor.controller.ControllerMethod;
import br.com.caelum.vraptor.interceptor.Interceptor;
import br.com.caelum.vraptor.ioc.Container;
import br.com.caelum.vraptor.observer.ExecuteMethodExceptionHandler;
import br.com.caelum.vraptor.validator.Message;
import br.com.caelum.vraptor.validator.ValidationException;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.io.IOException;
import java.util.ArrayList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.mockito.Mockito.*;

public class adhoc_ToInstantiateInterceptorHandlerTest {

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

    @Mock
    private Container container;

    @Mock
    private Interceptor interceptor;

    @Mock
    private InterceptorStack stack;

    @Mock
    private ControllerMethod method;

    @Before
    public void setup() {
        MockitoAnnotations.initMocks(this);
    }

    public static class MyWeirdInterceptor implements Interceptor {

        public MyWeirdInterceptor(Dependency d) {
        }

        @Override
        public void intercept(InterceptorStack stack, ControllerMethod method, Object resourceInstance) throws InterceptionException {
        }

        @Override
        public boolean accepts(ControllerMethod method) {
            return true;
        }
    }

    public static class Dependency {
    }

    private static class MyValidatedInterceptor implements Interceptor {

        @Override
        public void intercept(InterceptorStack stack, ControllerMethod method, Object controllerInstance) throws InterceptionException {
            throw new ValidationException(new ArrayList<Message>());
        }

        @Override
        public boolean accepts(ControllerMethod method) {
            return true;
        }
    }
    /*TEST PLACEHOLDER*/
}


"There are validation errors and you forgot to specify where to go."

@Test
public void shouldThrowExceptionIfMessagesHasUnhandledErrors() {
    messages.add(new SimpleMessage("Test", "Test message"));
    messages.assertAbsenceOfErrors();
}

@Test(expected = ValidationFailedException.class)
public void shouldThrowExceptionIfMessagesHasUnhandledErrors() {
    messages.add(new SimpleMessage("Test", "Test message"));
    messages.assertAbsenceOfErrors();
}

package br.com.caelum.vraptor.validator;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.el.ELProcessor;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class adhoc_MessagesTest {

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

    private Messages messages;

    @Before
    public void setUp() {
        messages = new Messages();
    }
    /*TEST PLACEHOLDER*/
}


" - You should not have more than one @BeforeCall annotated method"

@Test
public void shouldThrowsExceptionWhenInterceptorHasMoreThanOneAnnotatedMethod() {
    Class<?> interceptorClass = InterceptorWithMoreThanOneBeforeCallMethod.class;
    findMethod(interceptorClass, BeforeCall.class);
}

@Test(expected = IllegalStateException.class)
public void shouldThrowsExceptionWhenInterceptorHasMoreThanOneAnnotatedMethod() {
    Class<?> interceptorClass = InterceptorWithMoreThanOneBeforeCallMethod.class;
    findMethod(interceptorClass, BeforeCall.class);
}

package br.com.caelum.vraptor.interceptor;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.spy;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.List;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import br.com.caelum.vraptor.AroundCall;
import br.com.caelum.vraptor.BeforeCall;
import br.com.caelum.vraptor.core.DefaultReflectionProvider;
import br.com.caelum.vraptor.interceptor.example.ExampleOfSimpleStackInterceptor;
import br.com.caelum.vraptor.interceptor.example.InterceptorWithInheritance;
import br.com.caelum.vraptor.interceptor.example.WeldProxy$$$StyleInterceptor;

public class adhoc_StepInvokerTest {

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

    private StepInvoker stepInvoker = new StepInvoker(new DefaultReflectionProvider());

    private Method findMethod(Class<?> interceptorClass, Class<? extends Annotation> step) {
        List<Method> methods = stepInvoker.findAllMethods(interceptorClass);
        Method method = stepInvoker.findMethod(methods, step, interceptorClass);
        return method;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 48 shouldVerifyIfAcceptsMethodReturnsVoid shouldVerifyIfAcceptsMethodReturnsVoid

@Test
public void shouldVerifyIfAcceptsMethodReturnsVoid() {
    Class<VoidAcceptsInterceptor> type = VoidAcceptsInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    validationRule.validate(type, allMethods);
}

@Test(expected = InterceptionException.class)
public void shouldVerifyIfAcceptsMethodReturnsVoid() {
    Class<VoidAcceptsInterceptor> type = VoidAcceptsInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    validationRule.validate(type, allMethods);
}

package br.com.caelum.vraptor.interceptor;

import java.lang.reflect.Method;
import java.util.List;
import javax.enterprise.inject.Vetoed;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import br.com.caelum.vraptor.Accepts;
import br.com.caelum.vraptor.InterceptionException;
import br.com.caelum.vraptor.Intercepts;
import br.com.caelum.vraptor.core.DefaultReflectionProvider;

public class adhoc_AcceptsNeedReturnBooleanValidationRuleTest {

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

    private AcceptsNeedReturnBooleanValidationRule validationRule;

    private StepInvoker stepInvoker;

    @Before
    public void setUp() {
        stepInvoker = new StepInvoker(new DefaultReflectionProvider());
        validationRule = new AcceptsNeedReturnBooleanValidationRule(stepInvoker);
    }

    @Intercepts
    @Vetoed
    static class VoidAcceptsInterceptor {

        @Accepts
        public void accepts() {
        }
    }

    @Intercepts
    @Vetoed
    static class NonBooleanAcceptsInterceptor {

        @Accepts
        public String accepts() {
            return "";
        }
    }
    /*TEST PLACEHOLDER*/
}

@Test
public void shouldVerifyIfAcceptsMethodReturnsNonBooleanType() {
    Class<NonBooleanAcceptsInterceptor> type = NonBooleanAcceptsInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    validationRule.validate(type, allMethods);
}

@Test(expected = InterceptionException.class)
public void shouldVerifyIfAcceptsMethodReturnsNonBooleanType() {
    Class<NonBooleanAcceptsInterceptor> type = NonBooleanAcceptsInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    validationRule.validate(type, allMethods);
}


" must declare at least one method whith @AfterCall, @AroundCall or @BeforeCall annotation"

@Test
public void shoulThrowExceptionIfInterceptorDontHaveAnyCallableMethod() {
    Class<?> type = SimpleInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    new NoInterceptMethodsValidationRule(stepInvoker).validate(type, allMethods);
}

@Test(expected = InterceptionException.class)
public void shoulThrowExceptionIfInterceptorDontHaveAnyCallableMethod() {
    Class<?> type = SimpleInterceptor.class;
    List<Method> allMethods = stepInvoker.findAllMethods(type);
    new NoInterceptMethodsValidationRule(stepInvoker).validate(type, allMethods);
}

package br.com.caelum.vraptor.interceptor;

import java.lang.reflect.Method;
import java.util.List;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import br.com.caelum.vraptor.AfterCall;
import br.com.caelum.vraptor.InterceptionException;
import br.com.caelum.vraptor.Intercepts;
import br.com.caelum.vraptor.core.DefaultReflectionProvider;

public class adhoc_NoInterceptMethodsValidationRuleTest {

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

    private StepInvoker stepInvoker;

    @Intercepts
    class SimpleInterceptor {

        public void dummyMethodWithoutInterceptorAnnotations() {
        }
    }

    @Intercepts
    class SimpleInterceptorWithCallableMethod {

        @AfterCall
        public void afterCall() {
        }
    }

    @Before
    public void setUp() {
        this.stepInvoker = new StepInvoker(new DefaultReflectionProvider());
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 70 expected expected

SimpleName:IDENTIFIER 70 RuntimeException RuntimeException

SimpleName:IDENTIFIER 71 retryRetriesFailed retryRetriesFailed

SimpleName:IDENTIFIER 72 Exception Exception

SimpleName:IDENTIFIER 74 callable callable

SimpleName:IDENTIFIER 74 willThrow willThrow

SimpleName:IDENTIFIER 74 RuntimeException RuntimeException

SimpleName:IDENTIFIER 74 willReturn willReturn

SimpleName:IDENTIFIER 77 RetryUtils RetryUtils

SimpleName:IDENTIFIER 77 callable callable

SimpleName:IDENTIFIER 77 RETRIES RETRIES

SimpleName:IDENTIFIER 77 Collections Collections

SimpleName:IDENTIFIER 77 emptyList emptyList

@Test(expected = RuntimeException.class)
public void retryRetriesFailed() throws Exception {
    given(callable.call()).willThrow(new RuntimeException()).willThrow(new RuntimeException()).willReturn(RESULT);
    RetryUtils.retry(callable, RETRIES, Collections.<String>emptyList());
}

package com.hazelcast.kubernetes;

import com.hazelcast.core.HazelcastException;
import org.junit.Test;
import java.util.Collections;
import java.util.concurrent.Callable;
import static com.hazelcast.kubernetes.RetryUtils.BACKOFF_MULTIPLIER;
import static com.hazelcast.kubernetes.RetryUtils.INITIAL_BACKOFF_MS;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

public class adhoc_RetryUtilsTest {

    private static final Integer RETRIES = 1;

    private static final String RESULT = "result string";

    private static final String NON_RETRYABLE_KEYWORD = "\"reason\":\"Forbidden\"";

    private Callable<String> callable = mock(Callable.class);

    private static class NonRetryableException extends RuntimeException {

        private NonRetryableException() {
            super(String.format("Message: %s", NON_RETRYABLE_KEYWORD));
        }
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 83 expected expected

SimpleName:IDENTIFIER 83 HazelcastException HazelcastException

SimpleName:IDENTIFIER 84 retryRetriesFailedUncheckedException retryRetriesFailedUncheckedException

SimpleName:IDENTIFIER 85 Exception Exception

SimpleName:IDENTIFIER 87 callable callable

SimpleName:IDENTIFIER 87 willThrow willThrow

SimpleName:IDENTIFIER 87 Exception Exception

SimpleName:IDENTIFIER 87 willReturn willReturn

SimpleName:IDENTIFIER 90 RetryUtils RetryUtils

SimpleName:IDENTIFIER 90 callable callable

SimpleName:IDENTIFIER 90 RETRIES RETRIES

SimpleName:IDENTIFIER 90 Collections Collections

SimpleName:IDENTIFIER 90 emptyList emptyList

@Test(expected = HazelcastException.class)
public void retryRetriesFailedUncheckedException() throws Exception {
    given(callable.call()).willThrow(new Exception()).willThrow(new Exception()).willReturn(RESULT);
    RetryUtils.retry(callable, RETRIES, Collections.<String>emptyList());
}

SimpleName:IDENTIFIER 112 expected expected

SimpleName:IDENTIFIER 112 NonRetryableException NonRetryableException

SimpleName:IDENTIFIER 113 retryNonRetryableKeyword retryNonRetryableKeyword

SimpleName:IDENTIFIER 114 Exception Exception

SimpleName:IDENTIFIER 116 callable callable

SimpleName:IDENTIFIER 116 willThrow willThrow

SimpleName:IDENTIFIER 116 NonRetryableException NonRetryableException

SimpleName:IDENTIFIER 116 willReturn willReturn

SimpleName:IDENTIFIER 119 RetryUtils RetryUtils

SimpleName:IDENTIFIER 119 callable callable

SimpleName:IDENTIFIER 119 RETRIES RETRIES

@Test(expected = NonRetryableException.class)
public void retryNonRetryableKeyword() throws Exception {
    given(callable.call()).willThrow(new NonRetryableException()).willReturn(RESULT);
    RetryUtils.retry(callable, RETRIES, asList(NON_RETRYABLE_KEYWORD));
}


SimpleName:IDENTIFIER 71 expected expected

SimpleName:IDENTIFIER 71 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 72 testToWrapperArrayThrow testToWrapperArrayThrow

SimpleName:IDENTIFIER 72 Exception Exception

SimpleName:IDENTIFIER 73 toWrapperArray toWrapperArray

@Test(expected = IllegalArgumentException.class)
public void testToWrapperArrayThrow() throws Exception {
    toWrapperArray(this);
}

package cn.xdean.jex.reflect;

import org.junit.Test;
import static cn.xdean.jex.reflect.PrimitiveTypeUtil.*;
import static org.junit.Assert.*;

public class adhoc_PrimitiveTypeUtilTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 102 expected expected

SimpleName:IDENTIFIER 102 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 103 testToPrimitiveArrayThrow testToPrimitiveArrayThrow

SimpleName:IDENTIFIER 103 Exception Exception

SimpleName:IDENTIFIER 104 toPrimitiveArray toPrimitiveArray

@Test(expected = IllegalArgumentException.class)
public void testToPrimitiveArrayThrow() throws Exception {
    toPrimitiveArray(this);
}


SimpleName:IDENTIFIER 31 expected expected

SimpleName:IDENTIFIER 31 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 32 testLonger testLonger

SimpleName:IDENTIFIER 32 Exception Exception

SimpleName:IDENTIFIER 33 methodToFunctionInterface methodToFunctionInterface

StringLiteralExpr:LITERAL 33 "runnable" "runnable"

SimpleName:IDENTIFIER 33 Runnable Runnable

@Test(expected = IllegalArgumentException.class)
public void testLonger() throws Exception {
    methodToFunctionInterface(get("runnable"), null, Runnable.class, Object.class);
}

package cn.xdean.jex.reflect;

import org.junit.Ignore;
import org.junit.Test;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import static cn.xdean.jex.reflect.FunctionInterfaceUtil.getFunctionInterfaceMethod;
import static cn.xdean.jex.reflect.FunctionInterfaceUtil.methodToFunctionInterface;
import static org.junit.Assert.*;

@SuppressWarnings("unchecked")
public class adhoc_FunctionInterfaceUtilTest {

    private static Method get(String name) {
        return Arrays.stream(A.class.getDeclaredMethods()).filter(m -> m.getName().equals(name)).findFirst().get();
    }

    interface GenericInter {

        <T extends Runnable> T get(T t);
    }

    static class A {

        public static void runnable() {
        }

        public static int staticIntToInt(int i) {
            return i + 1;
        }

        public static <T> T objToObj(T t) {
            return t;
        }

        public static <T extends Runnable> T objToObj2(T t) {
            return t;
        }

        public static int mapInt(Integer i) {
            return i;
        }

        public static double mapDouble(Double d) {
            return d;
        }

        public static String stringList(List<String> list) {
            return list.toString();
        }
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 24 expected expected

SimpleName:IDENTIFIER 24 NoSuchElementException NoSuchElementException

SimpleName:IDENTIFIER 25 testNoResult testNoResult

@Test(expected = NoSuchElementException.class)
public void testNoResult() {
    If.that(true).result();
}

package cn.xdean.jex.lang.function;

import org.junit.Test;
import java.util.NoSuchElementException;
import static org.junit.Assert.assertEquals;

public class adhoc_IfTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 46 expected expected

SimpleName:IDENTIFIER 46 IllegalStateException IllegalStateException

SimpleName:IDENTIFIER 47 testFirstSuccessFail testFirstSuccessFail

SimpleName:IDENTIFIER 47 Exception Exception

SimpleName:IDENTIFIER 48 TaskUtil TaskUtil

SimpleName:IDENTIFIER 48 firstSuccess firstSuccess

SimpleName:IDENTIFIER 49 throwIt throwIt

SimpleName:IDENTIFIER 49 Exception Exception

SimpleName:IDENTIFIER 50 throwIt throwIt

SimpleName:IDENTIFIER 50 Exception Exception

@Test(expected = IllegalStateException.class)
public void testFirstSuccessFail() throws Exception {
    TaskUtil.firstSuccess(() -> throwIt(new Exception()), () -> throwIt(new Exception()));
}

package cn.xdean.jex.lang;

import cn.xdean.jex.lang.function.EmptyFunction;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import static cn.xdean.jex.lang.ExceptionUtil.throwIt;
import static cn.xdean.jex.lang.TaskUtil.andFinal;
import static cn.xdean.jex.lang.TaskUtil.async;
import static org.junit.Assert.*;

public class adhoc_TaskUtilTest {

    int hitCount;
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 70 expected expected

SimpleName:IDENTIFIER 70 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 71 testCompareIntThrow testCompareIntThrow

SimpleName:IDENTIFIER 71 Exception Exception

SimpleName:IDENTIFIER 72 assertTrue assertTrue

SimpleName:IDENTIFIER 72 compare compare

@Test(expected = IllegalArgumentException.class)
public void testCompareIntThrow() throws Exception {
    assertTrue(compare(new int[] { 1, 2, 3 }, new int[] { 1, 2 }) == 0);
}

package cn.xdean.jex.lang;

import org.junit.Test;
import static cn.xdean.jex.lang.collection.ArrayUtil.*;
import static org.junit.Assert.*;

public class adhoc_ArrayUtilTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 82 expected expected

SimpleName:IDENTIFIER 82 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 83 testCompareThrow testCompareThrow

SimpleName:IDENTIFIER 83 Exception Exception

SimpleName:IDENTIFIER 84 assertTrue assertTrue

SimpleName:IDENTIFIER 84 compare compare

SimpleName:IDENTIFIER 84 Integer Integer

@Test(expected = IllegalArgumentException.class)
public void testCompareThrow() throws Exception {
    assertTrue(compare(new Integer[] { 1, 2, 3 }, new Integer[] { 1, 2 }) == 0);
}


SimpleName:IDENTIFIER 17 expected expected

SimpleName:IDENTIFIER 17 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 18 testNewThrow testNewThrow

SimpleName:IDENTIFIER 18 Exception Exception

SimpleName:IDENTIFIER 19 MapUtil MapUtil

SimpleName:IDENTIFIER 19 newHashMap newHashMap

SimpleName:IDENTIFIER 19 Integer Integer

SimpleName:IDENTIFIER 20 assertEquals assertEquals

SimpleName:IDENTIFIER 20 intValue intValue

SimpleName:IDENTIFIER 21 assertEquals assertEquals

SimpleName:IDENTIFIER 21 intValue intValue

@Test(expected = IllegalArgumentException.class)
public void testNewThrow() throws Exception {
    HashMap<Integer, Integer> map = MapUtil.newHashMap(new Integer[] { 1, 2, 3 }, new Integer[] {});
    assertEquals(10, map.get(1).intValue());
    assertEquals(20, map.get(2).intValue());
}

package cn.xdean.jex.lang.collection;

import org.junit.Test;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;

public class adhoc_MapUtilTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 8 expected expected

SimpleName:IDENTIFIER 8 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 9 denyNullInstance denyNullInstance

SimpleName:IDENTIFIER 11 InstanceProvider InstanceProvider

{
    new InstanceProvider(null, null);
}

@Test(expected = IllegalArgumentException.class)
public void denyNullInstance() {
    new InstanceProvider(null, null);
}

{
    new InstanceProvider(null, null);
}

package com.github.tinosteinort.beanrepository;

import org.junit.Assert;
import org.junit.Test;

public class adhoc_InstanceProviderTest {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 70 expected expected

SimpleName:IDENTIFIER 70 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 71 getLastModifiedTime getLastModifiedTime

SimpleName:IDENTIFIER 71 IOException IOException

SimpleName:IDENTIFIER 72 getAttributes getAttributes

StringLiteralExpr:LITERAL 72 "path" "path"

SimpleName:IDENTIFIER 72 lastModifiedTime lastModifiedTime

@Test(expected = UnsupportedOperationException.class)
public void getLastModifiedTime() throws IOException {
    this.getAttributes("path", true).lastModifiedTime();
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.logging.Logger;
import junit.framework.Assert;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.Asset;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class adhoc_FileAttributesTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_FileAttributesTestCase.class.getName());

    private FileSystem fs;

    private JavaArchive archive;

    @Before
    public void createStore() throws IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        final FileSystem fs = ShrinkWrapFileSystems.newFileSystem(archive);
        this.archive = archive;
        this.fs = fs;
    }

    @After
    public void closeFs() throws IOException {
        this.fs.close();
    }

    private ShrinkWrapFileAttributes getAttributes(final String pathName, boolean create) {
        String attributesFor = pathName;
        if (create) {
            if (pathName.endsWith("/")) {
                attributesFor = pathName.substring(0, pathName.length() - 1);
                archive.addAsDirectory(attributesFor);
            } else {
                archive.add(EmptyAsset.INSTANCE, pathName);
            }
        }
        try {
            return Files.readAttributes(this.fs.getPath(attributesFor), ShrinkWrapFileAttributes.class, (LinkOption) null);
        } catch (final IOException ioe) {
            throw new RuntimeException(ioe);
        }
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 486 expected expected

SimpleName:IDENTIFIER 486 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 487 getLastModifiedTime getLastModifiedTime

SimpleName:IDENTIFIER 487 IOException IOException

SimpleName:IDENTIFIER 488 getArchive getArchive

SimpleName:IDENTIFIER 488 EmptyAsset EmptyAsset

SimpleName:IDENTIFIER 488 INSTANCE INSTANCE

StringLiteralExpr:LITERAL 488 "path" "path"

SimpleName:IDENTIFIER 489 getLastModifiedTime getLastModifiedTime

SimpleName:IDENTIFIER 489 getPath getPath

StringLiteralExpr:LITERAL 489 "path" "path"

SimpleName:IDENTIFIER 489 LinkOption LinkOption

@Test(expected = UnsupportedOperationException.class)
public void getLastModifiedTime() throws IOException {
    this.getArchive().add(EmptyAsset.INSTANCE, "path");
    Files.getLastModifiedTime(fs.getPath("path"), (LinkOption) null);
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.SeekableByteChannel;
import java.nio.charset.Charset;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.DirectoryStream;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.FileSystem;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.NoSuchFileException;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileAttribute;
import java.util.Iterator;
import java.util.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class adhoc_FilesTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_FilesTestCase.class.getName());

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

    private FileSystem fs;

    @Before
    public void createFileSystem() throws IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        this.fs = ShrinkWrapFileSystems.newFileSystem(archive);
    }

    @After
    public void closeFileSystem() throws IOException {
        this.fs.close();
    }

    private Archive<?> getArchive() {
        final ShrinkWrapFileSystem swfs = (ShrinkWrapFileSystem) this.fs;
        final Archive<?> archive = swfs.getArchive();
        return archive;
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 75 expected expected

SimpleName:IDENTIFIER 75 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 76 lastAccessTime lastAccessTime

SimpleName:IDENTIFIER 76 IOException IOException

SimpleName:IDENTIFIER 77 getAttributes getAttributes

StringLiteralExpr:LITERAL 77 "path" "path"

SimpleName:IDENTIFIER 77 lastAccessTime lastAccessTime

@Test(expected = UnsupportedOperationException.class)
public void lastAccessTime() throws IOException {
    this.getAttributes("path", true).lastAccessTime();
}


SimpleName:IDENTIFIER 80 expected expected

SimpleName:IDENTIFIER 80 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 81 creationTime creationTime

SimpleName:IDENTIFIER 81 IOException IOException

SimpleName:IDENTIFIER 82 getAttributes getAttributes

StringLiteralExpr:LITERAL 82 "path" "path"

SimpleName:IDENTIFIER 82 creationTime creationTime

@Test(expected = UnsupportedOperationException.class)
public void creationTime() throws IOException {
    this.getAttributes("path", true).creationTime();
}


SimpleName:IDENTIFIER 144 expected expected

SimpleName:IDENTIFIER 144 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 145 getPathNull getPathNull

SimpleName:IDENTIFIER 146 fileSystem fileSystem

SimpleName:IDENTIFIER 146 getPath getPath

@Test(expected = IllegalArgumentException.class)
public void getPathNull() {
    fileSystem.getPath(null);
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileStore;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.spi.FileSystemProvider;
import java.util.Set;
import java.util.logging.Logger;
import org.jboss.shrinkwrap.api.ArchivePath;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class adhoc_FileSystemTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_FileSystemTestCase.class.getName());

    private FileSystem fileSystem;

    private JavaArchive archive;

    @Before
    public void createFileSystem() throws URISyntaxException, IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        final FileSystem fs = ShrinkWrapFileSystems.newFileSystem(archive);
        this.fileSystem = fs;
        this.archive = archive;
    }

    @After
    public void closeFs() throws IOException {
        this.fileSystem.close();
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 96 expected expected

SimpleName:IDENTIFIER 96 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 97 getPathNullPath getPathNullPath

SimpleName:IDENTIFIER 98 fileSystem fileSystem

SimpleName:IDENTIFIER 98 getPath getPath

@Test(expected = IllegalArgumentException.class)
public void getPathNullPath() {
    fileSystem.getPath(null);
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystem;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.WatchEvent.Kind;
import java.util.Iterator;
import java.util.logging.Logger;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.GenericArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class adhoc_PathTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_PathTestCase.class.getName());

    private ShrinkWrapFileSystem fileSystem;

    @Before
    public void createFileSystem() throws URISyntaxException, IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        final ShrinkWrapFileSystem fs = (ShrinkWrapFileSystem) ShrinkWrapFileSystems.newFileSystem(archive);
        this.fileSystem = fs;
    }

    @After
    public void closeFs() throws IOException {
        this.fileSystem.close();
    }
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 170 expected expected

SimpleName:IDENTIFIER 170 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 172 getUserPrincipalLookupService getUserPrincipalLookupService

SimpleName:IDENTIFIER 173 fileSystem fileSystem

SimpleName:IDENTIFIER 173 getUserPrincipalLookupService getUserPrincipalLookupService

@Test(expected = UnsupportedOperationException.class)
public void getUserPrincipalLookupService() {
    fileSystem.getUserPrincipalLookupService();
}


SimpleName:IDENTIFIER 176 expected expected

SimpleName:IDENTIFIER 176 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 178 newWatchService newWatchService

SimpleName:IDENTIFIER 178 IOException IOException

SimpleName:IDENTIFIER 179 fileSystem fileSystem

SimpleName:IDENTIFIER 179 newWatchService newWatchService

@Test(expected = UnsupportedOperationException.class)
public void newWatchService() throws IOException {
    fileSystem.newWatchService();
}


SimpleName:IDENTIFIER 182 expected expected

SimpleName:IDENTIFIER 182 FileSystemAlreadyExistsException FileSystemAlreadyExistsException

SimpleName:IDENTIFIER 183 fileSystemAlreadyExists fileSystemAlreadyExists

SimpleName:IDENTIFIER 183 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 183 IOException IOException

SimpleName:IDENTIFIER 185 ShrinkWrapFileSystems ShrinkWrapFileSystems

SimpleName:IDENTIFIER 185 newFileSystem newFileSystem

SimpleName:IDENTIFIER 185 archive archive

@Test(expected = FileSystemAlreadyExistsException.class)
public void fileSystemAlreadyExists() throws IllegalArgumentException, IOException {
    ShrinkWrapFileSystems.newFileSystem(archive);
}

SimpleName:IDENTIFIER 43 expected expected

SimpleName:IDENTIFIER 43 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 44 IOException IOException

SimpleName:IDENTIFIER 45 FileSystems FileSystems

SimpleName:IDENTIFIER 45 newFileSystem newFileSystem

SimpleName:IDENTIFIER 45 ShrinkWrapFileSystems ShrinkWrapFileSystems

SimpleName:IDENTIFIER 45 PROTOCOL PROTOCOL

@Test(expected = IllegalArgumentException.class)
public void nullEnvironmentMakesIllegalArgumentException() throws IOException {
    FileSystems.newFileSystem(URI.create(ShrinkWrapFileSystems.PROTOCOL + "://myArchive.jar"), null);
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.spi.FileSystemProvider;
import java.util.logging.Logger;
import junit.framework.Assert;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;

public class adhoc_FileSystemProviderTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_FileSystemProviderTestCase.class.getName());
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 75 expected expected

SimpleName:IDENTIFIER 75 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 76 noArchiveInEnvShouldResultInIAE noArchiveInEnvShouldResultInIAE

SimpleName:IDENTIFIER 76 Exception Exception

SimpleName:IDENTIFIER 77 FileSystems FileSystems

SimpleName:IDENTIFIER 77 newFileSystem newFileSystem

SimpleName:IDENTIFIER 78 ShrinkWrapFileSystems ShrinkWrapFileSystems

SimpleName:IDENTIFIER 78 getRootUri getRootUri

SimpleName:IDENTIFIER 79 ShrinkWrap ShrinkWrap

SimpleName:IDENTIFIER 79 JavaArchive JavaArchive

SimpleName:IDENTIFIER 79 HashMap HashMap

@Test(expected = IllegalArgumentException.class)
public void noArchiveInEnvShouldResultInIAE() throws Exception {
    FileSystems.newFileSystem(ShrinkWrapFileSystems.getRootUri(ShrinkWrap.create(JavaArchive.class)), new HashMap());
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.IOException;
import java.net.URI;
import java.nio.file.FileSystems;
import java.util.HashMap;
import org.jboss.shrinkwrap.api.GenericArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;

public class adhoc_ShrinkWrapFileSystemsTestCase {
    /*TEST PLACEHOLDER*/
}


SimpleName:IDENTIFIER 283 expected expected

SimpleName:IDENTIFIER 283 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 284 subpathNegativeBegin subpathNegativeBegin

SimpleName:IDENTIFIER 285 fileSystem fileSystem

SimpleName:IDENTIFIER 285 getPath getPath

StringLiteralExpr:LITERAL 285 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 285 subpath subpath

@Test(expected = IllegalArgumentException.class)
public void subpathNegativeBegin() {
    fileSystem.getPath("/toplevel/second/third").subpath(-1, 1);
}

SimpleName:IDENTIFIER 288 expected expected

SimpleName:IDENTIFIER 288 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 289 subpathNegativeEnd subpathNegativeEnd

SimpleName:IDENTIFIER 290 fileSystem fileSystem

SimpleName:IDENTIFIER 290 getPath getPath

StringLiteralExpr:LITERAL 290 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 290 subpath subpath

@Test(expected = IllegalArgumentException.class)
public void subpathNegativeEnd() {
    fileSystem.getPath("/toplevel/second/third").subpath(0, -1);
}

SimpleName:IDENTIFIER 293 expected expected

SimpleName:IDENTIFIER 293 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 294 subpathEndBeforeBegin subpathEndBeforeBegin

SimpleName:IDENTIFIER 295 fileSystem fileSystem

SimpleName:IDENTIFIER 295 getPath getPath

StringLiteralExpr:LITERAL 295 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 295 subpath subpath

@Test(expected = IllegalArgumentException.class)
public void subpathEndBeforeBegin() {
    fileSystem.getPath("/toplevel/second/third").subpath(2, 1);
}

SimpleName:IDENTIFIER 298 expected expected

SimpleName:IDENTIFIER 298 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 299 subpathBeginTooLarge subpathBeginTooLarge

SimpleName:IDENTIFIER 300 fileSystem fileSystem

SimpleName:IDENTIFIER 300 getPath getPath

StringLiteralExpr:LITERAL 300 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 300 subpath subpath

@Test(expected = IllegalArgumentException.class)
public void subpathBeginTooLarge() {
    fileSystem.getPath("/toplevel/second/third").subpath(4, 5);
}

SimpleName:IDENTIFIER 303 expected expected

SimpleName:IDENTIFIER 303 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 304 subpathEndTooLarge subpathEndTooLarge

SimpleName:IDENTIFIER 305 fileSystem fileSystem

SimpleName:IDENTIFIER 305 getPath getPath

StringLiteralExpr:LITERAL 305 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 305 subpath subpath

@Test(expected = IllegalArgumentException.class)
public void subpathEndTooLarge() {
    fileSystem.getPath("/toplevel/second/third").subpath(2, 4);
}


SimpleName:IDENTIFIER 314 expected expected

SimpleName:IDENTIFIER 314 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 315 startsWithNullPathInput startsWithNullPathInput

SimpleName:IDENTIFIER 316 fileSystem fileSystem

SimpleName:IDENTIFIER 316 getPath getPath

StringLiteralExpr:LITERAL 316 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 316 startsWith startsWith

@Test(expected = IllegalArgumentException.class)
public void startsWithNullPathInput() {
    fileSystem.getPath("/toplevel/second/third").startsWith((Path) null);
}


SimpleName:IDENTIFIER 385 expected expected

SimpleName:IDENTIFIER 385 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 387 fileSystem fileSystem

SimpleName:IDENTIFIER 387 getPath getPath

StringLiteralExpr:LITERAL 387 "/toplevel" "/toplevel"

@Test(expected = UnsupportedOperationException.class)
public void toFile() {
    fileSystem.getPath("/toplevel").toFile();
}


SimpleName:IDENTIFIER 402 expected expected

SimpleName:IDENTIFIER 402 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 403 endsWithNullPathInput endsWithNullPathInput

SimpleName:IDENTIFIER 404 fileSystem fileSystem

SimpleName:IDENTIFIER 404 getPath getPath

StringLiteralExpr:LITERAL 404 "/toplevel/second/third" "/toplevel/second/third"

SimpleName:IDENTIFIER 404 endsWith endsWith

@Test(expected = IllegalArgumentException.class)
public void endsWithNullPathInput() {
    fileSystem.getPath("/toplevel/second/third").endsWith((Path) null);
}


SimpleName:IDENTIFIER 487 expected expected

SimpleName:IDENTIFIER 487 FileNotFoundException FileNotFoundException

SimpleName:IDENTIFIER 488 toRealPathDoesntExist toRealPathDoesntExist

SimpleName:IDENTIFIER 488 IOException IOException

SimpleName:IDENTIFIER 489 newPathName newPathName

StringLiteralExpr:LITERAL 489 "/toplevel/myAsset" "/toplevel/myAsset"

SimpleName:IDENTIFIER 490 fileSystem fileSystem

SimpleName:IDENTIFIER 490 getPath getPath

SimpleName:IDENTIFIER 490 newPathName newPathName

SimpleName:IDENTIFIER 491 toRealPath toRealPath

SimpleName:IDENTIFIER 491 LinkOption LinkOption

@Test(expected = FileNotFoundException.class)
public void toRealPathDoesntExist() throws IOException {
    final String newPathName = "/toplevel/myAsset";
    final Path path = fileSystem.getPath(newPathName);
    path.toRealPath((LinkOption[]) null);
}


SimpleName:IDENTIFIER 554 expected expected

SimpleName:IDENTIFIER 554 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 555 relativizeNull relativizeNull

SimpleName:IDENTIFIER 556 fileSystem fileSystem

SimpleName:IDENTIFIER 556 getPath getPath

StringLiteralExpr:LITERAL 556 "/toplevel/myAsset" "/toplevel/myAsset"

SimpleName:IDENTIFIER 557 relativize relativize

@Test(expected = IllegalArgumentException.class)
public void relativizeNull() {
    final Path path = fileSystem.getPath("/toplevel/myAsset");
    path.relativize(null);
}


SimpleName:IDENTIFIER 596 expected expected

SimpleName:IDENTIFIER 596 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 597 resolveNull resolveNull

SimpleName:IDENTIFIER 598 fileSystem fileSystem

SimpleName:IDENTIFIER 598 getPath getPath

StringLiteralExpr:LITERAL 598 "/toplevel/myDir/" "/toplevel/myDir/"

SimpleName:IDENTIFIER 598 resolve resolve

@Test(expected = IllegalArgumentException.class)
public void resolveNull() {
    fileSystem.getPath("/toplevel/myDir/").resolve((Path) null);
}


SimpleName:IDENTIFIER 643 expected expected

SimpleName:IDENTIFIER 643 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 644 resolveSiblingNull resolveSiblingNull

SimpleName:IDENTIFIER 645 fileSystem fileSystem

SimpleName:IDENTIFIER 645 getPath getPath

StringLiteralExpr:LITERAL 645 "/toplevel/myDir/" "/toplevel/myDir/"

SimpleName:IDENTIFIER 645 resolveSibling resolveSibling

@Test(expected = IllegalArgumentException.class)
public void resolveSiblingNull() {
    fileSystem.getPath("/toplevel/myDir/").resolveSibling((Path) null);
}


SimpleName:IDENTIFIER 690 expected expected

SimpleName:IDENTIFIER 690 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 691 compareToNull compareToNull

SimpleName:IDENTIFIER 691 IOException IOException

SimpleName:IDENTIFIER 692 fileSystem fileSystem

SimpleName:IDENTIFIER 692 getPath getPath

StringLiteralExpr:LITERAL 692 "/toplevel/a" "/toplevel/a"

SimpleName:IDENTIFIER 692 compareTo compareTo

@Test(expected = IllegalArgumentException.class)
public void compareToNull() throws IOException {
    fileSystem.getPath("/toplevel/a").compareTo(null);
}


SimpleName:IDENTIFIER 83 expected expected

SimpleName:IDENTIFIER 83 FileSystemNotFoundException FileSystemNotFoundException

SimpleName:IDENTIFIER 84 getNonexistantFilesystem getNonexistantFilesystem

SimpleName:IDENTIFIER 84 URISyntaxException URISyntaxException

SimpleName:IDENTIFIER 85 ShrinkWrapFileSystems ShrinkWrapFileSystems

SimpleName:IDENTIFIER 85 PROTOCOL PROTOCOL

@Test(expected = FileSystemNotFoundException.class)
public void getNonexistantFilesystem() throws URISyntaxException {
    Paths.get(new URI(ShrinkWrapFileSystems.PROTOCOL + "://fakeId"));
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.spi.FileSystemProvider;
import java.util.logging.Logger;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

public class adhoc_PathsTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(adhoc_PathsTestCase.class.getName());

    private FileSystem fs;

    private Archive<?> archive;

    @Before
    public void createFileSystem() throws IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        this.fs = ShrinkWrapFileSystems.newFileSystem(archive);
        this.archive = archive;
    }

    @After
    public void closeFileSystem() throws IOException {
        if (this.fs.isOpen()) {
            this.fs.close();
        }
    }
    /*TEST PLACEHOLDER*/
}

SimpleName:IDENTIFIER 88 expected expected

SimpleName:IDENTIFIER 88 FileSystemNotFoundException FileSystemNotFoundException

SimpleName:IDENTIFIER 89 getClosedFilesystem getClosedFilesystem

SimpleName:IDENTIFIER 89 URISyntaxException URISyntaxException

SimpleName:IDENTIFIER 89 IOException IOException

SimpleName:IDENTIFIER 91 ShrinkWrapFileSystems ShrinkWrapFileSystems

SimpleName:IDENTIFIER 91 getRootUri getRootUri

SimpleName:IDENTIFIER 91 archive archive

@Test(expected = FileSystemNotFoundException.class)
public void getClosedFilesystem() throws URISyntaxException, IOException {
    fs.close();
    Paths.get(ShrinkWrapFileSystems.getRootUri(archive));
}


SimpleName:IDENTIFIER 469 expected expected

SimpleName:IDENTIFIER 469 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 470 getAttribute getAttribute

SimpleName:IDENTIFIER 470 IOException IOException

SimpleName:IDENTIFIER 471 getAttribute getAttribute

SimpleName:IDENTIFIER 471 getPath getPath

StringLiteralExpr:LITERAL 471 "file" "file"

StringLiteralExpr:LITERAL 471 "basic" "basic"

SimpleName:IDENTIFIER 471 LinkOption LinkOption

@Test(expected = UnsupportedOperationException.class)
public void getAttribute() throws IOException {
    Files.getAttribute(fs.getPath("file"), "basic", (LinkOption) null);
}


SimpleName:IDENTIFIER 497 expected expected

SimpleName:IDENTIFIER 497 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 498 getPosixFilePermissions getPosixFilePermissions

SimpleName:IDENTIFIER 498 IOException IOException

SimpleName:IDENTIFIER 499 getPosixFilePermissions getPosixFilePermissions

SimpleName:IDENTIFIER 499 getPath getPath

StringLiteralExpr:LITERAL 499 "path" "path"

SimpleName:IDENTIFIER 499 LinkOption LinkOption

@Test(expected = UnsupportedOperationException.class)
public void getPosixFilePermissions() throws IOException {
    Files.getPosixFilePermissions(fs.getPath("path"), (LinkOption) null);
}


SimpleName:IDENTIFIER 672 expected expected

SimpleName:IDENTIFIER 672 IllegalArgumentException IllegalArgumentException

SimpleName:IDENTIFIER 673 newByteChannelForReadDoesntExist newByteChannelForReadDoesntExist

SimpleName:IDENTIFIER 673 IOException IOException

SimpleName:IDENTIFIER 674 newByteChannel newByteChannel

SimpleName:IDENTIFIER 674 getPath getPath

StringLiteralExpr:LITERAL 674 "path" "path"

SimpleName:IDENTIFIER 674 OpenOption OpenOption

@Test(expected = IllegalArgumentException.class)
public void newByteChannelForReadDoesntExist() throws IOException {
    Files.newByteChannel(fs.getPath("path"), (OpenOption) null);
}


SimpleName:IDENTIFIER 766 Throwable Throwable

@Test
public void createdDirectoryStreamThrowsExceptionWhenIsClosed() throws Throwable {
    Path dirPath = fs.getPath("dir");
    Files.createDirectory(dirPath);
    Files.createFile(dirPath.resolve("file"));
    DirectoryStream<Path> stream = Files.newDirectoryStream(dirPath);
    stream.close();
    Iterator<Path> it = stream.iterator();
}

@Test(expected = IllegalStateException.class)
public void createdDirectoryStreamThrowsExceptionWhenIsClosed() throws Throwable {
    Path dirPath = fs.getPath("dir");
    Files.createDirectory(dirPath);
    Files.createFile(dirPath.resolve("file"));
    DirectoryStream<Path> stream = Files.newDirectoryStream(dirPath);
    stream.close();
    Iterator<Path> it = stream.iterator();
}

SimpleName:IDENTIFIER 783 Exception Exception

@Test
public void createdDirectoryStreamThrowsExceptionWhenIteratorWasReturnedBefore() throws Exception {
    Path dirPath = fs.getPath("dir");
    Files.createDirectory(dirPath);
    Files.createFile(dirPath.resolve("file"));
    DirectoryStream<Path> stream = Files.newDirectoryStream(dirPath);
    Iterator<Path> it = stream.iterator();
    stream.iterator();
}

@Test(expected = IllegalStateException.class)
public void createdDirectoryStreamThrowsExceptionWhenIteratorWasReturnedBefore() throws Exception {
    Path dirPath = fs.getPath("dir");
    Files.createDirectory(dirPath);
    Files.createFile(dirPath.resolve("file"));
    DirectoryStream<Path> stream = Files.newDirectoryStream(dirPath);
    Iterator<Path> it = stream.iterator();
    stream.iterator();
}


SimpleName:IDENTIFIER 72 expected expected

SimpleName:IDENTIFIER 72 UnsupportedOperationException UnsupportedOperationException

SimpleName:IDENTIFIER 73 setTimes setTimes

SimpleName:IDENTIFIER 73 IOException IOException

SimpleName:IDENTIFIER 74 attributeView attributeView

SimpleName:IDENTIFIER 74 getAttributesView getAttributesView

StringLiteralExpr:LITERAL 74 "path" "path"

SimpleName:IDENTIFIER 75 fileTime fileTime

SimpleName:IDENTIFIER 75 FileTime FileTime

SimpleName:IDENTIFIER 75 fromMillis fromMillis

SimpleName:IDENTIFIER 76 attributeView attributeView

SimpleName:IDENTIFIER 76 setTimes setTimes

SimpleName:IDENTIFIER 76 fileTime fileTime

@Test(expected = UnsupportedOperationException.class)
public void setTimes() throws IOException {
    BasicFileAttributeView attributeView = getAttributesView("path");
    FileTime fileTime = FileTime.fromMillis(0);
    attributeView.setTimes(fileTime, fileTime, fileTime);
}

package org.jboss.shrinkwrap.impl.base.nio2.file;

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
import java.util.logging.Logger;
import junit.framework.Assert;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.nio2.file.ShrinkWrapFileSystems;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class adhoc_FileAttributesViewTestCase {

    @SuppressWarnings("unused")
    private static final Logger log = Logger.getLogger(FileAttributesTestCase.class.getName());

    private FileSystem fs;

    private JavaArchive archive;

    @Before
    public void createStore() throws IOException {
        final String name = "test.jar";
        final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, name);
        final FileSystem fs = ShrinkWrapFileSystems.newFileSystem(archive);
        this.archive = archive;
        this.fs = fs;
    }

    @After
    public void closeFs() throws IOException {
        this.fs.close();
    }

    private ShrinkWrapFileAttributeView getAttributesView(final String pathName) {
        archive.add(EmptyAsset.INSTANCE, pathName);
        return Files.getFileAttributeView(this.fs.getPath(pathName), ShrinkWrapFileAttributeView.class, (LinkOption) null);
    }
    /*TEST PLACEHOLDER*/
}