From 12193e96fa8b39a8444ea97586ffa13ee8730e30 Mon Sep 17 00:00:00 2001 From: Tomasz Lelek Date: Tue, 21 Feb 2017 17:29:29 +0100 Subject: [PATCH] BAEL-633 proper formatting and test naming --- .../src/main/java/com/baeldung/cglib/mixin/Class1.java | 8 ++++---- .../src/main/java/com/baeldung/cglib/mixin/Class2.java | 8 ++++---- .../main/java/com/baeldung/cglib/mixin/Interface1.java | 2 +- .../main/java/com/baeldung/cglib/mixin/Interface2.java | 2 +- .../com/baeldung/cglib/proxy/BeanGeneratorTest.java | 10 +++++++--- .../test/java/com/baeldung/cglib/proxy/MixinTest.java | 2 +- .../baeldung/cglib/proxy/PersonServiceProxyTest.java | 6 +++--- pom.xml | 2 +- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/cglib/src/main/java/com/baeldung/cglib/mixin/Class1.java b/cglib/src/main/java/com/baeldung/cglib/mixin/Class1.java index 932951b4cd..fa0cba5b78 100644 --- a/cglib/src/main/java/com/baeldung/cglib/mixin/Class1.java +++ b/cglib/src/main/java/com/baeldung/cglib/mixin/Class1.java @@ -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"; + } } \ No newline at end of file diff --git a/cglib/src/main/java/com/baeldung/cglib/mixin/Class2.java b/cglib/src/main/java/com/baeldung/cglib/mixin/Class2.java index b2b922a05d..0db0620ab8 100644 --- a/cglib/src/main/java/com/baeldung/cglib/mixin/Class2.java +++ b/cglib/src/main/java/com/baeldung/cglib/mixin/Class2.java @@ -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"; + } } \ No newline at end of file diff --git a/cglib/src/main/java/com/baeldung/cglib/mixin/Interface1.java b/cglib/src/main/java/com/baeldung/cglib/mixin/Interface1.java index 5aab155c1d..56ad679cad 100644 --- a/cglib/src/main/java/com/baeldung/cglib/mixin/Interface1.java +++ b/cglib/src/main/java/com/baeldung/cglib/mixin/Interface1.java @@ -1,5 +1,5 @@ package com.baeldung.cglib.mixin; public interface Interface1 { - String first(); + String first(); } \ No newline at end of file diff --git a/cglib/src/main/java/com/baeldung/cglib/mixin/Interface2.java b/cglib/src/main/java/com/baeldung/cglib/mixin/Interface2.java index 7fd2e78608..0dfb8737ab 100644 --- a/cglib/src/main/java/com/baeldung/cglib/mixin/Interface2.java +++ b/cglib/src/main/java/com/baeldung/cglib/mixin/Interface2.java @@ -1,5 +1,5 @@ package com.baeldung.cglib.mixin; public interface Interface2 { - String second(); + String second(); } \ No newline at end of file diff --git a/cglib/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorTest.java b/cglib/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorTest.java index 32706409c5..67214cd32d 100644 --- a/cglib/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorTest.java +++ b/cglib/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorTest.java @@ -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)); } } diff --git a/cglib/src/test/java/com/baeldung/cglib/proxy/MixinTest.java b/cglib/src/test/java/com/baeldung/cglib/proxy/MixinTest.java index ac4b50af4c..186c66aa42 100644 --- a/cglib/src/test/java/com/baeldung/cglib/proxy/MixinTest.java +++ b/cglib/src/test/java/com/baeldung/cglib/proxy/MixinTest.java @@ -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}, diff --git a/cglib/src/test/java/com/baeldung/cglib/proxy/PersonServiceProxyTest.java b/cglib/src/test/java/com/baeldung/cglib/proxy/PersonServiceProxyTest.java index e0ad017538..6208ed12b8 100644 --- a/cglib/src/test/java/com/baeldung/cglib/proxy/PersonServiceProxyTest.java +++ b/cglib/src/test/java/com/baeldung/cglib/proxy/PersonServiceProxyTest.java @@ -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); diff --git a/pom.xml b/pom.xml index a32a204304..52e00edbb4 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ autovalue cdi + cglib core-java couchbase-sdk @@ -192,7 +193,6 @@ xstream struts2 - cglib apache-velocity