[prev in list] [next in list] [prev in thread] [next in thread]
List: jakarta-commons-dev
Subject: svn commit: r1508994 - in /commons/proper/proxy/branches/version-2.0-work/stub/src:
From: jcarman () apache ! org
Date: 2013-07-31 19:27:46
Message-ID: 20130731192746.DD80423889FD () eris ! apache ! org
[Download RAW message or body]
Author: jcarman
Date: Wed Jul 31 19:27:46 2013
New Revision: 1508994
URL: http://svn.apache.org/r1508994
Log:
Renaming configure -> trainFor and Behavior -> Trainer
Added:
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java
- copied, changed from r1508708, \
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Behavior.java
Removed:
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Behavior.java
Modified:
commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java
commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/ \
src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java?rev=1508994&r1=1508993&r2=1508994&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java \
(original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/StubInterceptorBuilder.java \
Wed Jul 31 19:27:46 2013 @@ -52,13 +52,13 @@ public class StubInterceptorBuilder
return interceptor;
}
- public <T> StubInterceptorBuilder configure(Class<T> type, Behavior<T> behavior)
+ public <T> StubInterceptorBuilder trainFor(Class<T> type, Trainer<T> trainer)
{
try
{
TrainingContext.set(interceptor);
T stub = proxyFactory.createInvokerProxy(new TrainingContextInvoker(), \
type);
- behavior.train(stub);
+ trainer.train(stub);
}
finally
{
Copied: commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java \
(from r1508708, commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Behavior.java)
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/ \
src/main/java/org/apache/commons/proxy2/stub/Trainer.java?p2=commons/proper/proxy/bran \
ches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java&p \
1=commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Behavior.java&r1=1508708&r2=1508994&rev=1508994&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Behavior.java \
(original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/main/java/org/apache/commons/proxy2/stub/Trainer.java \
Wed Jul 31 19:27:46 2013 @@ -24,7 +24,7 @@ import org.apache.commons.proxy2.interce
import org.apache.commons.proxy2.interceptor.matcher.ArgumentMatcher;
import org.apache.commons.proxy2.interceptor.matcher.argument.ArgumentMatcherUtils;
-public abstract class Behavior<T>
+public abstract class Trainer<T>
{
//----------------------------------------------------------------------------------------------------------------------
// Abstract Methods
@@ -130,112 +130,112 @@ public abstract class Behavior<T>
protected abstract class BaseWhen<R>
{
- protected Behavior<T> thenThrow(Exception e)
+ protected Trainer<T> thenThrow(Exception e)
{
trainingContext().setInterceptor(InterceptorUtils.throwing(e));
- return Behavior.this;
+ return Trainer.this;
}
- protected Behavior<T> thenThrow(ObjectProvider<? extends Exception> \
provider) + protected Trainer<T> thenThrow(ObjectProvider<? extends Exception> \
provider) {
trainingContext().setInterceptor(InterceptorUtils.throwing(provider));
- return Behavior.this;
+ return Trainer.this;
}
- protected <R> Behavior<T> thenAnswer(ObjectProvider<? extends R> provider)
+ protected <R> Trainer<T> thenAnswer(ObjectProvider<? extends R> provider)
{
trainingContext().setInterceptor(InterceptorUtils.provider(provider));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenBooleanArray extends BaseWhen<boolean[]>
{
- protected Behavior<T> thenReturn(boolean... values)
+ protected Trainer<T> thenReturn(boolean... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenByteArray extends BaseWhen<byte[]>
{
- protected Behavior<T> thenReturn(byte... values)
+ protected Trainer<T> thenReturn(byte... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenCharArray extends BaseWhen<char[]>
{
- protected Behavior<T> thenReturn(char... values)
+ protected Trainer<T> thenReturn(char... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenDoubleArray extends BaseWhen<double[]>
{
- protected Behavior<T> thenReturn(double... values)
+ protected Trainer<T> thenReturn(double... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenFloatArray extends BaseWhen<float[]>
{
- protected Behavior<T> thenReturn(float... values)
+ protected Trainer<T> thenReturn(float... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenIntArray extends BaseWhen<int[]>
{
- protected Behavior<T> thenReturn(int... values)
+ protected Trainer<T> thenReturn(int... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenLongArray extends BaseWhen<long[]>
{
- protected Behavior<T> thenReturn(long... values)
+ protected Trainer<T> thenReturn(long... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenObject<R> extends BaseWhen
{
- protected Behavior<T> thenReturn(R value)
+ protected Trainer<T> thenReturn(R value)
{
trainingContext().setInterceptor(InterceptorUtils.constant(value));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenObjectArray<R> extends BaseWhen<R[]>
{
- protected Behavior<T> thenReturn(R... values)
+ protected Trainer<T> thenReturn(R... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
protected class WhenShortArray extends BaseWhen<short[]>
{
- protected Behavior<T> thenReturn(short... values)
+ protected Trainer<T> thenReturn(short... values)
{
trainingContext().setInterceptor(InterceptorUtils.constant(ArrayUtils.clone(values)));
- return Behavior.this;
+ return Trainer.this;
}
}
}
Modified: commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/branches/version-2.0-work/stub/ \
src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java?rev=1508994&r1=1508993&r2=1508994&view=diff
==============================================================================
--- commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java \
(original)
+++ commons/proper/proxy/branches/version-2.0-work/stub/src/test/java/org/apache/commons/proxy2/stub/StubInterceptorBuilderTest.java \
Wed Jul 31 19:27:46 2013 @@ -54,7 +54,7 @@ public class StubInterceptorBuilderTest
@Test(expected = IllegalArgumentException.class)
public void testThrowExceptionWithException()
{
- StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -69,7 +69,7 @@ public class StubInterceptorBuilderTest
@Test(expected = IllegalArgumentException.class)
public void testThrowExceptionWithProvidedException()
{
- StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -84,7 +84,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithArrayParameter()
{
- StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -99,7 +99,7 @@ public class StubInterceptorBuilderTest
@Test
public void testAnyMatcher()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -114,7 +114,7 @@ public class StubInterceptorBuilderTest
@Test(expected = IllegalStateException.class)
public void testMixingArgumentMatchingStrategies()
{
- builder.configure(StubInterface.class, new Behavior<StubInterface>()
+ builder.trainFor(StubInterface.class, new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -127,7 +127,7 @@ public class StubInterceptorBuilderTest
@Test(expected = RuntimeException.class)
public void testThrowingExceptionObject()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -141,7 +141,7 @@ public class StubInterceptorBuilderTest
@Test(expected = RuntimeException.class)
public void testThrowingProvidedException()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -155,7 +155,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithArgumentMatchers()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -167,9 +167,9 @@ public class StubInterceptorBuilderTest
assertEquals("World", proxy.one("Whatever"));
}
- private StubInterface createProxy(Behavior<StubInterface> behavior)
+ private StubInterface createProxy(Trainer<StubInterface> trainer)
{
- Interceptor interceptor = builder.configure(StubInterface.class, \
behavior).build(); + Interceptor interceptor = \
builder.trainFor(StubInterface.class, trainer).build();
return proxyFactory.createInterceptorProxy(target, interceptor, \
StubInterface.class); }
@@ -177,7 +177,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithStringArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -191,7 +191,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithBooleanArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -205,7 +205,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithByteArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -219,7 +219,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithShortArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -233,7 +233,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithIntArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -247,7 +247,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithLongArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -261,7 +261,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithFloatArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -275,7 +275,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithDoubleArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -289,7 +289,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithCharArray()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -303,7 +303,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithMismatchedArgument()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -318,7 +318,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithMultipleMethodsTrained()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
@@ -334,7 +334,7 @@ public class StubInterceptorBuilderTest
@Test
public void testWithSingleMethodTrained()
{
- final StubInterface proxy = createProxy(new Behavior<StubInterface>()
+ final StubInterface proxy = createProxy(new Trainer<StubInterface>()
{
@Override
protected void train(StubInterface stub)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic