BAEL-633 proper formatting and test naming

This commit is contained in:
Tomasz Lelek 2017-02-21 17:29:29 +01:00
parent 5b1135cae6
commit 12193e96fa
8 changed files with 22 additions and 18 deletions

View File

@ -1,8 +1,8 @@
package com.baeldung.cglib.mixin; package com.baeldung.cglib.mixin;
public class Class1 implements Interface1 { public class Class1 implements Interface1 {
@Override @Override
public String first() { public String first() {
return "first behaviour"; return "first behaviour";
} }
} }

View File

@ -1,8 +1,8 @@
package com.baeldung.cglib.mixin; package com.baeldung.cglib.mixin;
public class Class2 implements Interface2 { public class Class2 implements Interface2 {
@Override @Override
public String second() { public String second() {
return "second behaviour"; return "second behaviour";
} }
} }

View File

@ -1,5 +1,5 @@
package com.baeldung.cglib.mixin; package com.baeldung.cglib.mixin;
public interface Interface1 { public interface Interface1 {
String first(); String first();
} }

View File

@ -1,5 +1,5 @@
package com.baeldung.cglib.mixin; package com.baeldung.cglib.mixin;
public interface Interface2 { public interface Interface2 {
String second(); String second();
} }

View File

@ -11,18 +11,22 @@ import static junit.framework.TestCase.assertEquals;
public class BeanGeneratorTest { public class BeanGeneratorTest {
@Test @Test
public void testBeanGenerator() throws Exception { public void givenBeanCreator_whenAddPropery_classShouldHaveFieldValue() throws Exception {
//given //given
BeanGenerator beanGenerator = new BeanGenerator(); BeanGenerator beanGenerator = new BeanGenerator();
//when //when
beanGenerator.addProperty("name", String.class); beanGenerator.addProperty("name", String.class);
Object myBean = beanGenerator.create(); 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"); setter.invoke(myBean, "some string value set by a cglib");
//then //then
Method getter = myBean.getClass().getMethod("getName"); Method getter = myBean
.getClass()
.getMethod("getName");
assertEquals("some string value set by a cglib", getter.invoke(myBean)); assertEquals("some string value set by a cglib", getter.invoke(myBean));
} }
} }

View File

@ -9,7 +9,7 @@ import static junit.framework.TestCase.assertEquals;
public class MixinTest { public class MixinTest {
@Test @Test
public void testMixinBehaviour() throws Exception { public void givenTwoClasses_whenMixtThemIntoOne_mixinShouldHaveMethodsFromBothClasses() throws Exception {
//when //when
Mixin mixin = Mixin.create( Mixin mixin = Mixin.create(
new Class[]{Interface1.class, Interface2.class, MixinInterface.class}, new Class[]{Interface1.class, Interface2.class, MixinInterface.class},

View File

@ -9,7 +9,7 @@ import static org.junit.Assert.assertEquals;
public class PersonServiceProxyTest { public class PersonServiceProxyTest {
@Test @Test
public void testService() { public void givenPersonService_whenSayHello_shouldReturnResult() {
//given //given
PersonService personService = new PersonService(); PersonService personService = new PersonService();
@ -21,7 +21,7 @@ public class PersonServiceProxyTest {
} }
@Test @Test
public void testFixedValue() throws Exception { public void givenEnhancerProxy_whenExtendPersonService_shouldInterceptMethod() throws Exception {
//given //given
Enhancer enhancer = new Enhancer(); Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(PersonService.class); enhancer.setSuperclass(PersonService.class);
@ -36,7 +36,7 @@ public class PersonServiceProxyTest {
} }
@Test @Test
public void testMethodInterceptor() throws Exception { public void givenEnhancer_whenExecuteMethodOnProxy_shouldInterceptOnlyStringReturnTypeMethod() throws Exception {
//given //given
Enhancer enhancer = new Enhancer(); Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(PersonService.class); enhancer.setSuperclass(PersonService.class);

View File

@ -28,6 +28,7 @@
<module>autovalue</module> <module>autovalue</module>
<module>cdi</module> <module>cdi</module>
<module>cglib</module>
<!-- <module>core-java-9</module> --> <!-- <module>core-java-9</module> -->
<module>core-java</module> <module>core-java</module>
<module>couchbase-sdk</module> <module>couchbase-sdk</module>
@ -192,7 +193,6 @@
<module>xstream</module> <module>xstream</module>
<module>struts2</module> <module>struts2</module>
<module>cglib</module>
<module>apache-velocity</module> <module>apache-velocity</module>