use of net.bytebuddy.description.ByteCodeElement in project byte-buddy by raphw.
the class ElementMatchersTest method testNamedIgnoreCase.
@Test
public void testNamedIgnoreCase() throws Exception {
ByteCodeElement byteCodeElement = mock(ByteCodeElement.class);
when(byteCodeElement.getActualName()).thenReturn(FOO);
assertThat(ElementMatchers.namedIgnoreCase(FOO).matches(byteCodeElement), is(true));
assertThat(ElementMatchers.namedIgnoreCase(FOO.toUpperCase()).matches(byteCodeElement), is(true));
assertThat(ElementMatchers.namedIgnoreCase(BAR).matches(byteCodeElement), is(false));
}
use of net.bytebuddy.description.ByteCodeElement in project byte-buddy by raphw.
the class ElementMatchersTest method testHasDescriptor.
@Test
public void testHasDescriptor() throws Exception {
ByteCodeElement byteCodeElement = mock(ByteCodeElement.class);
when(byteCodeElement.getDescriptor()).thenReturn(FOO);
assertThat(ElementMatchers.hasDescriptor(FOO).matches(byteCodeElement), is(true));
assertThat(ElementMatchers.hasDescriptor(FOO.toUpperCase()).matches(byteCodeElement), is(false));
assertThat(ElementMatchers.hasDescriptor(BAR).matches(byteCodeElement), is(false));
}
use of net.bytebuddy.description.ByteCodeElement in project byte-buddy by raphw.
the class ElementMatchersTest method testNameMatches.
@Test
public void testNameMatches() throws Exception {
ByteCodeElement byteCodeElement = mock(ByteCodeElement.class);
when(byteCodeElement.getActualName()).thenReturn(FOO);
assertThat(ElementMatchers.nameMatches("^" + FOO + "$").matches(byteCodeElement), is(true));
assertThat(ElementMatchers.nameMatches(FOO.toUpperCase()).matches(byteCodeElement), is(false));
assertThat(ElementMatchers.nameMatches(BAR).matches(byteCodeElement), is(false));
}
use of net.bytebuddy.description.ByteCodeElement in project byte-buddy by raphw.
the class ElementMatchersTest method testNameStartsWithIgnoreCase.
@Test
public void testNameStartsWithIgnoreCase() throws Exception {
ByteCodeElement byteCodeElement = mock(ByteCodeElement.class);
when(byteCodeElement.getActualName()).thenReturn(FOO);
assertThat(ElementMatchers.nameStartsWithIgnoreCase(FOO.substring(0, 2)).matches(byteCodeElement), is(true));
assertThat(ElementMatchers.nameStartsWithIgnoreCase(FOO.substring(0, 2).toUpperCase()).matches(byteCodeElement), is(true));
assertThat(ElementMatchers.nameStartsWithIgnoreCase(BAR).matches(byteCodeElement), is(false));
}
use of net.bytebuddy.description.ByteCodeElement in project byte-buddy by raphw.
the class ElementMatchersTest method testNamed.
@Test
public void testNamed() throws Exception {
ByteCodeElement byteCodeElement = mock(ByteCodeElement.class);
when(byteCodeElement.getActualName()).thenReturn(FOO);
assertThat(named(FOO).matches(byteCodeElement), is(true));
assertThat(named(FOO.toUpperCase()).matches(byteCodeElement), is(false));
assertThat(named(BAR).matches(byteCodeElement), is(false));
}
Aggregations