BAEL-633 proper formatting and test naming
This commit is contained in:
parent
5b1135cae6
commit
12193e96fa
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.cglib.mixin;
|
||||
|
||||
public class Class1 implements Interface1 {
|
||||
@Override
|
||||
public String first() {
|
||||
return "first behaviour";
|
||||
}
|
||||
@Override
|
||||
public String first() {
|
||||
return "first behaviour";
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.cglib.mixin;
|
||||
|
||||
public class Class2 implements Interface2 {
|
||||
@Override
|
||||
public String second() {
|
||||
return "second behaviour";
|
||||
}
|
||||
@Override
|
||||
public String second() {
|
||||
return "second behaviour";
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package com.baeldung.cglib.mixin;
|
||||
|
||||
public interface Interface1 {
|
||||
String first();
|
||||
String first();
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package com.baeldung.cglib.mixin;
|
||||
|
||||
public interface Interface2 {
|
||||
String second();
|
||||
String second();
|
||||
}
|
|
@ -11,18 +11,22 @@ import static junit.framework.TestCase.assertEquals;
|
|||
public class BeanGeneratorTest {
|
||||
|
||||
@Test
|
||||
public void testBeanGenerator() throws Exception {
|
||||
public void givenBeanCreator_whenAddPropery_classShouldHaveFieldValue() throws Exception {
|
||||
//given
|
||||
BeanGenerator beanGenerator = new BeanGenerator();
|
||||
|
||||
//when
|
||||
beanGenerator.addProperty("name", String.class);
|
||||
Object myBean = beanGenerator.create();
|
||||
Method setter = myBean.getClass().getMethod("setName", String.class);
|
||||
Method setter = myBean
|
||||
.getClass()
|
||||
.getMethod("setName", String.class);
|
||||
setter.invoke(myBean, "some string value set by a cglib");
|
||||
|
||||
//then
|
||||
Method getter = myBean.getClass().getMethod("getName");
|
||||
Method getter = myBean
|
||||
.getClass()
|
||||
.getMethod("getName");
|
||||
assertEquals("some string value set by a cglib", getter.invoke(myBean));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import static junit.framework.TestCase.assertEquals;
|
|||
public class MixinTest {
|
||||
|
||||
@Test
|
||||
public void testMixinBehaviour() throws Exception {
|
||||
public void givenTwoClasses_whenMixtThemIntoOne_mixinShouldHaveMethodsFromBothClasses() throws Exception {
|
||||
//when
|
||||
Mixin mixin = Mixin.create(
|
||||
new Class[]{Interface1.class, Interface2.class, MixinInterface.class},
|
||||
|
|
|
@ -9,7 +9,7 @@ import static org.junit.Assert.assertEquals;
|
|||
|
||||
public class PersonServiceProxyTest {
|
||||
@Test
|
||||
public void testService() {
|
||||
public void givenPersonService_whenSayHello_shouldReturnResult() {
|
||||
//given
|
||||
PersonService personService = new PersonService();
|
||||
|
||||
|
@ -21,7 +21,7 @@ public class PersonServiceProxyTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testFixedValue() throws Exception {
|
||||
public void givenEnhancerProxy_whenExtendPersonService_shouldInterceptMethod() throws Exception {
|
||||
//given
|
||||
Enhancer enhancer = new Enhancer();
|
||||
enhancer.setSuperclass(PersonService.class);
|
||||
|
@ -36,7 +36,7 @@ public class PersonServiceProxyTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMethodInterceptor() throws Exception {
|
||||
public void givenEnhancer_whenExecuteMethodOnProxy_shouldInterceptOnlyStringReturnTypeMethod() throws Exception {
|
||||
//given
|
||||
Enhancer enhancer = new Enhancer();
|
||||
enhancer.setSuperclass(PersonService.class);
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -28,6 +28,7 @@
|
|||
<module>autovalue</module>
|
||||
|
||||
<module>cdi</module>
|
||||
<module>cglib</module>
|
||||
<!-- <module>core-java-9</module> -->
|
||||
<module>core-java</module>
|
||||
<module>couchbase-sdk</module>
|
||||
|
@ -192,7 +193,6 @@
|
|||
<module>xstream</module>
|
||||
|
||||
<module>struts2</module>
|
||||
<module>cglib</module>
|
||||
<module>apache-velocity</module>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue