git://wamblee.org
/
utils
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
(no commit message)
[utils]
/
support
/
general
/
src
/
test
/
java
/
org
/
wamblee
/
general
/
LookupProxyFactoryTest.java
diff --git
a/support/general/src/test/java/org/wamblee/general/LookupProxyFactoryTest.java
b/support/general/src/test/java/org/wamblee/general/LookupProxyFactoryTest.java
index 5dbf81ad3a78a3105b569e2355599d3cbe9e37b2..dd8930c0df88250e0e6d95ef73415e69ec05765c 100644
(file)
--- a/
support/general/src/test/java/org/wamblee/general/LookupProxyFactoryTest.java
+++ b/
support/general/src/test/java/org/wamblee/general/LookupProxyFactoryTest.java
@@
-45,9
+45,9
@@
public class LookupProxyFactoryTest {
public void setUp() throws Exception {
intf = mock(MyInterface.class);
lookup = mock(Lookup.class);
public void setUp() throws Exception {
intf = mock(MyInterface.class);
lookup = mock(Lookup.class);
-
+
LookupProxyFactory<MyInterface> factory = new LookupProxyFactory<MyInterface>(
LookupProxyFactory<MyInterface> factory = new LookupProxyFactory<MyInterface>(
- MyInterface.class, lookup);
+ MyInterface.class, lookup);
proxy = factory.getProxy();
}
proxy = factory.getProxy();
}
@@
-67,7
+67,8
@@
public class LookupProxyFactoryTest {
@Test(expected = LookupException.class)
public void testNotFoundAtJndi() throws Exception {
@Test(expected = LookupException.class)
public void testNotFoundAtJndi() throws Exception {
- when(lookup.lookup()).thenThrow(new RuntimeException("Object not found"));
+ when(lookup.lookup()).thenThrow(
+ new RuntimeException("Object not found"));
proxy.execute();
}
proxy.execute();
}
@@
-95,13
+96,13
@@
public class LookupProxyFactoryTest {
assertEquals(NAA_NA_NA_NAA_NA, e.getMessage());
}
}
assertEquals(NAA_NA_NA_NAA_NA, e.getMessage());
}
}
-
- private static final class MyLookup implements Lookup {
-
+
+ private static final class MyLookup implements Lookup {
+
@Override
public Object lookup() throws Exception {
return new MyInterface() {
@Override
public Object lookup() throws Exception {
return new MyInterface() {
-
+
@Override
public int execute() {
return 10;
@Override
public int execute() {
return 10;
@@
-109,24
+110,23
@@
public class LookupProxyFactoryTest {
};
}
}
};
}
}
-
- @Test
+
+ @Test
public void testProxyMustBerializable() throws Exception {
lookup = new MyLookup();
LookupProxyFactory<MyInterface> factory = new LookupProxyFactory<MyInterface>(
public void testProxyMustBerializable() throws Exception {
lookup = new MyLookup();
LookupProxyFactory<MyInterface> factory = new LookupProxyFactory<MyInterface>(
- MyInterface.class, lookup);
+ MyInterface.class, lookup);
proxy = factory.getProxy();
proxy = factory.getProxy();
-
+
+ assertEquals(10, proxy.execute());
+
+ assertTrue(proxy instanceof Serializable);
+
+ proxy = ObjectSerializationUtils.deserialize(ObjectSerializationUtils
+ .serialize(proxy), MyInterface.class);
+
+ // and it should still work
assertEquals(10, proxy.execute());
assertEquals(10, proxy.execute());
-
- assertTrue(proxy instanceof Serializable);
-
- proxy = ObjectSerializationUtils.deserialize(ObjectSerializationUtils.serialize(proxy),
- MyInterface.class);
-
- // and it should still work
- assertEquals(10, proxy.execute());
}
}
-
}
}