Skip to content

Commit e0147b4

Browse files
committed
Update package
1 parent d507f19 commit e0147b4

File tree

4 files changed

+47
-80
lines changed

4 files changed

+47
-80
lines changed

src/com/jimmyhowe/support/exceptions/ValueStoreException.java

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
11
package com.jimmyhowe.support.stores;
22

33
import com.jimmyhowe.support.contracts.Countable;
4+
import com.jimmyhowe.support.contracts.DataParameterAccess;
45

56
import java.util.ArrayList;
7+
import java.util.List;
68

79
/**
810
* Stores Objects
911
*/
10-
public class ObjectStore implements Countable
12+
public class ObjectStore implements DataParameterAccess, Countable
1113
{
12-
protected ArrayList<Object> data = new ArrayList<>();
13-
14-
public ArrayList<Object> data()
15-
{
16-
return data;
17-
}
14+
/**
15+
* Data
16+
*/
17+
private List<Object> data = new ArrayList<>();
1818

19-
public Object data(int i)
19+
/**
20+
* @param object
21+
*/
22+
public void put(Object object)
2023
{
21-
return data().get(i);
24+
this.data.add(object);
2225
}
2326

24-
public void put(Object object)
27+
/**
28+
* Returns the Data Object
29+
*/
30+
@Override
31+
public List data()
2532
{
26-
this.data.add(object);
33+
return data;
2734
}
2835

29-
public boolean isEmpty()
36+
/**
37+
* Helper to get data at index
38+
*
39+
* @param index Index of value
40+
*/
41+
@Override
42+
public Object data(int index)
3043
{
31-
return data.isEmpty();
44+
return data.get(index);
3245
}
3346

3447
/**
@@ -39,4 +52,12 @@ public int count()
3952
{
4053
return this.data.size();
4154
}
55+
56+
/**
57+
* @return True or False if empty
58+
*/
59+
public boolean isEmpty()
60+
{
61+
return data.isEmpty();
62+
}
4263
}

tests/com/jimmyhowe/support/stores/ObjectStoreTest.java

Lines changed: 0 additions & 33 deletions
This file was deleted.

tests/com/jimmyhowe/support/stores/ValueStoreTest.java

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
import org.junit.Before;
55
import org.junit.Test;
66

7-
import static org.junit.Assert.*;
7+
import static junit.framework.TestCase.assertEquals;
88

99
/**
1010
* Created by Jimmy on 27/09/2016.
1111
*/
1212
public class ValueStoreTest
1313
{
14+
private ValueStore store;
15+
1416
@Before
1517
public void setUp() throws Exception
1618
{
17-
19+
this.store = new ValueStore();
1820
}
1921

2022
@After
@@ -23,52 +25,41 @@ public void tearDown() throws Exception
2325

2426
}
2527

26-
@Test
27-
public void updateThing() throws Exception
28-
{
29-
30-
}
31-
3228
@Test
3329
public void add() throws Exception
3430
{
35-
31+
store.add(1, 2, 3);
3632
}
3733

3834
@Test
3935
public void toCsv() throws Exception
4036
{
37+
store.add(1, 2, 3);
4138

39+
assertEquals("1, 2, 3", store.toCsv());
4240
}
4341

4442
@Test
4543
public void addQuotes() throws Exception
4644
{
45+
store.add(1, 2, 3);
4746

47+
assertEquals("('1', '2', '3')", store.addQuotes().toWrappedInBraces());
4848
}
4949

5050
@Test
5151
public void toWrappedInBraces() throws Exception
5252
{
53+
store.add(1, 2, 3);
5354

54-
}
55-
56-
@Test
57-
public void cleanUp() throws Exception
58-
{
59-
60-
}
61-
62-
@Test
63-
public void get() throws Exception
64-
{
65-
55+
assertEquals("(1, 2, 3)", store.toWrappedInBraces());
6656
}
6757

6858
@Test
6959
public void count() throws Exception
7060
{
61+
store.add(1, 2, 3);
7162

63+
assertEquals(3, store.count());
7264
}
73-
7465
}

0 commit comments

Comments
 (0)