summaryrefslogtreecommitdiffstats
path: root/test/jrummikub
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-01 19:14:55 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-01 19:14:55 +0200
commitb2dbfcc317d7cdec57cc4081801e75a9d25b1d07 (patch)
tree1b45352d56a4eeb3543ca1257eb322a691150607 /test/jrummikub
parent5436407515a14ed6a53276c26f0b8403ec27020f (diff)
downloadJRummikub-b2dbfcc317d7cdec57cc4081801e75a9d25b1d07.tar
JRummikub-b2dbfcc317d7cdec57cc4081801e75a9d25b1d07.zip
Fix formatting
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@52 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'test/jrummikub')
-rw-r--r--test/jrummikub/util/Event1Test.java147
-rw-r--r--test/jrummikub/util/Event2Test.java7
-rw-r--r--test/jrummikub/util/EventTest.java149
3 files changed, 153 insertions, 150 deletions
diff --git a/test/jrummikub/util/Event1Test.java b/test/jrummikub/util/Event1Test.java
index b7e56bf..f414bf5 100644
--- a/test/jrummikub/util/Event1Test.java
+++ b/test/jrummikub/util/Event1Test.java
@@ -6,77 +6,78 @@ import org.junit.Test;
public class Event1Test {
- int fired, fired2;
-
- @Test
- public void singleListener() {
- fired = 0;
- Event1<Integer> testEvent = new Event1<Integer>();
- testEvent.add(new IListener1<Integer>() {
-
- @Override
- public void fire(Integer n) {
- fired += n;
-
- }
- });
- assertEquals(fired, 0);
- testEvent.fire(10);
- assertEquals(fired, 10);
- testEvent.fire(20);
- assertEquals(fired, 30);
- }
-
- @Test
- public void twoListeners() {
- fired = 0;
- fired2 = 0;
- Event1<Integer> testEvent = new Event1<Integer>();
- testEvent.add(new IListener1<Integer>() {
-
- @Override
- public void fire(Integer n) {
- fired += n;
-
- }
- });
- testEvent.add(new IListener1<Integer>() {
-
- @Override
- public void fire(Integer n) {
- fired2 -= n;
-
- }
- });
- assertEquals(fired, 0);
- assertEquals(fired2, 0);
- testEvent.fire(5);
- assertEquals(fired, 5);
- assertEquals(fired2, -5);
-
- }
-
- @Test public void removeListener() {
- fired = 0;
- Event1<Integer> testEvent = new Event1<Integer>();
- testEvent.add(new IListener1<Integer>() {
-
- @Override
- public void fire(Integer n) {
- fired += n;
-
- }
- });
- IListener1<Integer> rem = new IListener1<Integer>() {
-
- @Override
- public void fire(Integer n) {
- fail();
- }
- };
- testEvent.add(rem);
- testEvent.remove(rem);
- testEvent.fire(10);
- assertEquals(fired, 10);
- }
+ int fired, fired2;
+
+ @Test
+ public void singleListener() {
+ fired = 0;
+ Event1<Integer> testEvent = new Event1<Integer>();
+ testEvent.add(new IListener1<Integer>() {
+
+ @Override
+ public void fire(Integer n) {
+ fired += n;
+
+ }
+ });
+ assertEquals(fired, 0);
+ testEvent.fire(10);
+ assertEquals(fired, 10);
+ testEvent.fire(20);
+ assertEquals(fired, 30);
+ }
+
+ @Test
+ public void twoListeners() {
+ fired = 0;
+ fired2 = 0;
+ Event1<Integer> testEvent = new Event1<Integer>();
+ testEvent.add(new IListener1<Integer>() {
+
+ @Override
+ public void fire(Integer n) {
+ fired += n;
+
+ }
+ });
+ testEvent.add(new IListener1<Integer>() {
+
+ @Override
+ public void fire(Integer n) {
+ fired2 -= n;
+
+ }
+ });
+ assertEquals(fired, 0);
+ assertEquals(fired2, 0);
+ testEvent.fire(5);
+ assertEquals(fired, 5);
+ assertEquals(fired2, -5);
+
+ }
+
+ @Test
+ public void removeListener() {
+ fired = 0;
+ Event1<Integer> testEvent = new Event1<Integer>();
+ testEvent.add(new IListener1<Integer>() {
+
+ @Override
+ public void fire(Integer n) {
+ fired += n;
+
+ }
+ });
+ IListener1<Integer> rem = new IListener1<Integer>() {
+
+ @Override
+ public void fire(Integer n) {
+ fail();
+ }
+ };
+ testEvent.add(rem);
+ testEvent.remove(rem);
+ testEvent.fire(10);
+ assertEquals(fired, 10);
+ }
}
diff --git a/test/jrummikub/util/Event2Test.java b/test/jrummikub/util/Event2Test.java
index cbfecd5..c3d9c2a 100644
--- a/test/jrummikub/util/Event2Test.java
+++ b/test/jrummikub/util/Event2Test.java
@@ -64,8 +64,9 @@ public class Event2Test {
assertEquals(fired3, -5);
assertEquals(fired4, -10);
}
-
- @Test public void removeListener() {
+
+ @Test
+ public void removeListener() {
fired = 0;
fired2 = 0;
Event2<Integer, Integer> testEvent = new Event2<Integer, Integer>();
@@ -78,7 +79,7 @@ public class Event2Test {
}
});
IListener2<Integer, Integer> rem = new IListener2<Integer, Integer>() {
-
+
@Override
public void fire(Integer n, Integer m) {
fail();
diff --git a/test/jrummikub/util/EventTest.java b/test/jrummikub/util/EventTest.java
index 0595306..a4fb94f 100644
--- a/test/jrummikub/util/EventTest.java
+++ b/test/jrummikub/util/EventTest.java
@@ -4,79 +4,80 @@ import org.junit.Test;
import static org.junit.Assert.*;
public class EventTest {
- boolean fired, fired2;
-
- @Test
- public void singleListener() {
- fired = false;
- Event testEvent = new Event();
- testEvent.add(new IListener() {
-
- @Override
- public void fire() {
- fired = true;
-
- }
- });
- assertFalse(fired);
- testEvent.fire();
- assertTrue(fired);
- fired = false;
- testEvent.fire();
- assertTrue(fired);
- }
-
- @Test
- public void twoListeners() {
- fired = false;
- fired2 = false;
- Event testEvent = new Event();
- testEvent.add(new IListener() {
-
- @Override
- public void fire() {
- fired = true;
-
- }
- });
- testEvent.add(new IListener() {
-
- @Override
- public void fire() {
- fired2 = true;
-
- }
- });
- assertFalse(fired);
- assertFalse(fired2);
- testEvent.fire();
- assertTrue(fired);
- assertTrue(fired2);
-
- }
-
- @Test public void removeListener() {
- fired = false;
- Event testEvent = new Event();
- testEvent.add(new IListener() {
-
- @Override
- public void fire() {
- fired = true;
-
- }
- });
- IListener rem = new IListener() {
-
- @Override
- public void fire() {
- fail();
- }
- };
- testEvent.add(rem);
- testEvent.remove(rem);
- testEvent.fire();
- assertTrue(fired);
- }
+ boolean fired, fired2;
+
+ @Test
+ public void singleListener() {
+ fired = false;
+ Event testEvent = new Event();
+ testEvent.add(new IListener() {
+
+ @Override
+ public void fire() {
+ fired = true;
+
+ }
+ });
+ assertFalse(fired);
+ testEvent.fire();
+ assertTrue(fired);
+ fired = false;
+ testEvent.fire();
+ assertTrue(fired);
+ }
+
+ @Test
+ public void twoListeners() {
+ fired = false;
+ fired2 = false;
+ Event testEvent = new Event();
+ testEvent.add(new IListener() {
+
+ @Override
+ public void fire() {
+ fired = true;
+
+ }
+ });
+ testEvent.add(new IListener() {
+
+ @Override
+ public void fire() {
+ fired2 = true;
+
+ }
+ });
+ assertFalse(fired);
+ assertFalse(fired2);
+ testEvent.fire();
+ assertTrue(fired);
+ assertTrue(fired2);
+
+ }
+
+ @Test
+ public void removeListener() {
+ fired = false;
+ Event testEvent = new Event();
+ testEvent.add(new IListener() {
+
+ @Override
+ public void fire() {
+ fired = true;
+
+ }
+ });
+ IListener rem = new IListener() {
+
+ @Override
+ public void fire() {
+ fail();
+ }
+ };
+ testEvent.add(rem);
+ testEvent.remove(rem);
+ testEvent.fire();
+ assertTrue(fired);
+ }
}