Skip to content
Snippets Groups Projects
Commit 8db8d936 authored by Goik Martin's avatar Goik Martin
Browse files

Suppress "potentially static" warning

parent 79439d50
No related branches found
No related tags found
No related merge requests found
......@@ -8,41 +8,42 @@ import de.hdm_stuttgart.mi.sd1.store.IntegerStore;
@SuppressWarnings("javadoc")
public class IntStoreTest {
@Test
public void testPositiveNegative() {
final int capacity = 3;
IntegerStore store = new IntegerStore(capacity);
assertEquals(capacity, store.getCapacity()); // The store's initial capacity
assertEquals(0, store.getNumValues()); // Store is initially empty
final int v1 = -17, v2 = 3, v3 = -4, v4 = 7;
store.addValue(v1); // Add a single value
assertEquals(1, store.getNumValues()); // Store contains one value
assertEquals(v1, store.getValue(0)); // Value should be present at index 0
store.addValue(v2); // Add two more values
store.addValue(v3);
assertEquals(capacity, store.getCapacity()); // The store's initial capacity
assertEquals(3, store.getNumValues()); // Store contains three values
assertEquals(v1, store.getValue(0)); // Retrieve all values
assertEquals(v2, store.getValue(1));
assertEquals(v3, store.getValue(2));
// Now we breach the container's initial capacity
store.addValue(v4);
assertEquals(2 * capacity, store.getCapacity()); // Twice the store's initial capacity
// add 99996 more values
for (int i = 4; i < 100_000; i++) {
store.addValue(i);
}
assertEquals(100_000, store.getNumValues());
assertTrue(100_000 <= store.getCapacity()); // Capacity should at least be 100_000
}
@SuppressWarnings("static-method")
@Test
public void testPositiveNegative() {
final int capacity = 3;
IntegerStore store = new IntegerStore(capacity);
assertEquals(capacity, store.getCapacity()); // The store's initial capacity
assertEquals(0, store.getNumValues()); // Store is initially empty
final int v1 = -17, v2 = 3, v3 = -4, v4 = 7;
store.addValue(v1); // Add a single value
assertEquals(1, store.getNumValues()); // Store contains one value
assertEquals(v1, store.getValue(0)); // Value should be present at index 0
store.addValue(v2); // Add two more values
store.addValue(v3);
assertEquals(capacity, store.getCapacity()); // The store's initial capacity
assertEquals(3, store.getNumValues()); // Store contains three values
assertEquals(v1, store.getValue(0)); // Retrieve all values
assertEquals(v2, store.getValue(1));
assertEquals(v3, store.getValue(2));
// Now we breach the container's initial capacity
store.addValue(v4);
assertEquals(2 * capacity, store.getCapacity()); // Twice the store's initial capacity
// add 99996 more values
for (int i = 4; i < 100_000; i++) {
store.addValue(i);
}
assertEquals(100_000, store.getNumValues());
assertTrue(100_000 <= store.getCapacity()); // Capacity should at least be 100_000
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment