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;
public class Class1 implements Interface1 {
@Override
public String first() {
return "first behaviour";
}
@Override
public String first() {
return "first behaviour";
}
}

View File

@ -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";
}
}

View File

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

View File

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

View File

@ -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));
}
}

View File

@ -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},

View File

@ -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);

View File

@ -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>