Skip to content

Commit

Permalink
Renamed tests to their appropriate packages and added test.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 5, 2016
1 parent 99e525b commit 28bf084
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
Expand Up @@ -10,7 +10,7 @@
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class TypeDescriptionGenericVisitorForAttachmentTest {
public class TypeDescriptionGenericVisitorSubstitutorForAttachmentTest {

private static final String FOO = "foo";

Expand Down
Expand Up @@ -10,7 +10,7 @@
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;

public class TypeDescriptionGenericVisitorForDetachmentTest {
public class TypeDescriptionGenericVisitorSubstitutorForDetachmentTest {

private static final String FOO = "foo";

Expand Down
@@ -1,10 +1,55 @@
package net.bytebuddy.description.type;

import net.bytebuddy.test.utility.MockitoRule;
import net.bytebuddy.test.utility.ObjectPropertyAssertion;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.mockito.Mock;

import java.util.HashMap;
import java.util.Map;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

public class TypeDescriptionGenericVisitorSubstitutorForTypeVariableBindingTest {

@Rule
public TestRule mockitoRule = new MockitoRule(this);

@Mock
private TypeDescription.Generic source, target, unknown;

private Map<TypeDescription.Generic, TypeDescription.Generic> mapping;

@Before
public void setUp() throws Exception {
mapping = new HashMap<TypeDescription.Generic, TypeDescription.Generic>();
mapping.put(source, target);
}

@Test(expected = UnsupportedOperationException.class)
public void testSimpleType() throws Exception {
new TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding(mapping).onSimpleType(source);
}

@Test
public void testNonGenericType() throws Exception {
assertThat(new TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding(mapping).onNonGenericType(source), is(source));
}

@Test
public void testTypeVariableKnown() throws Exception {
assertThat(new TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding(mapping).onTypeVariable(source), is(target));
}

@Test(expected = IllegalStateException.class)
public void testTypeVariableUnknown() throws Exception {
new TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding(mapping).onTypeVariable(unknown);
}

@Test
public void testObjectProperties() throws Exception {
ObjectPropertyAssertion.of(TypeDescription.Generic.Visitor.Substitutor.ForTypeVariableBinding.class).apply();
Expand Down

0 comments on commit 28bf084

Please sign in to comment.