| 1 | import static org.junit.Assert.assertEquals;
|
|---|
| 2 |
|
|---|
| 3 | import java.util.ArrayList;
|
|---|
| 4 | import java.util.List;
|
|---|
| 5 |
|
|---|
| 6 | import org.junit.Test;
|
|---|
| 7 |
|
|---|
| 8 | import model.PresetCounter;
|
|---|
| 9 | import model.TagCatalog.IndoorObject;
|
|---|
| 10 |
|
|---|
| 11 | public class PresetCounterTest {
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | * Test case for testing the ranking functionality.
|
|---|
| 15 | */
|
|---|
| 16 | @Test
|
|---|
| 17 | public void testRanking() {
|
|---|
| 18 | // input preparation
|
|---|
| 19 | PresetCounter counter = new PresetCounter();
|
|---|
| 20 |
|
|---|
| 21 | counter.count(IndoorObject.CONCRETE_WALL);
|
|---|
| 22 | counter.count(IndoorObject.CONCRETE_WALL);
|
|---|
| 23 | counter.count(IndoorObject.CONCRETE_WALL);
|
|---|
| 24 | counter.count(IndoorObject.ROOM);
|
|---|
| 25 | counter.count(IndoorObject.ROOM);
|
|---|
| 26 | counter.count(IndoorObject.STEPS);
|
|---|
| 27 | counter.count(IndoorObject.TOILET_MALE);
|
|---|
| 28 |
|
|---|
| 29 | List<IndoorObject> actualList = counter.getRanking();
|
|---|
| 30 |
|
|---|
| 31 | //expectation
|
|---|
| 32 | List<IndoorObject> expectedList = new ArrayList<>();
|
|---|
| 33 | expectedList.add(IndoorObject.CONCRETE_WALL);
|
|---|
| 34 | expectedList.add(IndoorObject.ROOM);
|
|---|
| 35 | expectedList.add(IndoorObject.TOILET_MALE);
|
|---|
| 36 | expectedList.add(IndoorObject.STEPS);
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | //assertion
|
|---|
| 40 | assertEquals(expectedList.get(0), actualList.get(0));
|
|---|
| 41 | assertEquals(expectedList.get(1), actualList.get(1));
|
|---|
| 42 | assertEquals(expectedList.get(2), actualList.get(2));
|
|---|
| 43 | assertEquals(expectedList.get(3), actualList.get(3));
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|