PageRenderTime 17ms CodeModel.GetById 2ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/server/report/generator/map/LRTBComparatorTest.java

http://sigma-h.googlecode.com/
Java | 59 lines | 37 code | 15 blank | 7 comment | 1 complexity | ca4172559c378e152e24a75cb5329fea MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.server.report.generator.map;
 7
 8import junit.framework.Assert;
 9import org.junit.Test;
10import org.sigmah.shared.report.content.MapMarker;
11
12import java.util.ArrayList;
13import java.util.Collections;
14import java.util.List;
15
16/**
17 * @author Alex Bertram
18 */
19public class LRTBComparatorTest {
20
21    @Test
22    public void testComparator() {
23
24        MapMarker ul = new MapMarker();
25        ul.setX(1);
26        ul.setY(1);
27
28        MapMarker ul2 = new MapMarker();
29        ul2.setX(60);
30        ul2.setY(0);
31
32        MapMarker c = new MapMarker();
33        c.setX(30);
34        c.setY(50);
35
36        MapMarker ll = new MapMarker();
37        ll.setX(0);
38        ll.setY(80);
39
40        List<MapMarker> list = new ArrayList<MapMarker>();
41        list.add(ll);
42        list.add(c);
43        list.add(ul2);
44        list.add(ul);
45
46        Collections.sort(list, new MapMarker.LRTBComparator());
47
48        for(MapMarker marker : list) {
49            System.out.println(marker.toString());
50        }
51
52        Assert.assertEquals(ul, list.get(0));
53        Assert.assertEquals(ul2, list.get(1));
54        Assert.assertEquals(c, list.get(2));
55        Assert.assertEquals(ll, list.get(3));
56
57
58    }
59}