mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
8ca5fda9cc
commit
01e7173f62
1 changed files with 20 additions and 24 deletions
|
@ -1,19 +1,19 @@
|
|||
package org.logstash;
|
||||
|
||||
import org.junit.experimental.theories.DataPoint;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.experimental.theories.Theories;
|
||||
import org.junit.experimental.theories.Theory;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.theories.DataPoint;
|
||||
import org.junit.experimental.theories.Theories;
|
||||
import org.junit.experimental.theories.Theory;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class AccessorsTest {
|
||||
|
||||
|
@ -23,10 +23,6 @@ public class AccessorsTest {
|
|||
super(data);
|
||||
}
|
||||
|
||||
public Map<String, Object> getLut() {
|
||||
return lut;
|
||||
}
|
||||
|
||||
public Object lutGet(String reference) {
|
||||
return this.lut.get(reference);
|
||||
}
|
||||
|
@ -238,6 +234,16 @@ public class AccessorsTest {
|
|||
assertEquals(accessors.get("[foo]"), "boom");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListIndexOutOfBounds() {
|
||||
assertEquals(Accessors.listIndex(0, 10), 0);
|
||||
assertEquals(Accessors.listIndex(1, 10), 1);
|
||||
assertEquals(Accessors.listIndex(9, 10), 9);
|
||||
assertEquals(Accessors.listIndex(-1, 10), 9);
|
||||
assertEquals(Accessors.listIndex(-9, 10), 1);
|
||||
assertEquals(Accessors.listIndex(-10, 10), 0);
|
||||
}
|
||||
|
||||
@RunWith(Theories.class)
|
||||
public static class TestListIndexFailureCases {
|
||||
private static final int size = 10;
|
||||
|
@ -261,14 +267,4 @@ public class AccessorsTest {
|
|||
}
|
||||
}
|
||||
|
||||
public static class TestListIndex {
|
||||
public void testListIndexOutOfBounds() {
|
||||
assertEquals(Accessors.listIndex(0, 10), 0);
|
||||
assertEquals(Accessors.listIndex(1, 10), 1);
|
||||
assertEquals(Accessors.listIndex(9, 10), 9);
|
||||
assertEquals(Accessors.listIndex(-1, 10), 9);
|
||||
assertEquals(Accessors.listIndex(-9, 10), 1);
|
||||
assertEquals(Accessors.listIndex(-10, 10), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue