import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.aaf.auth.helpers.MonthData;
+import org.onap.aaf.auth.helpers.MonthData.Row;
+
+import junit.framework.Assert;
import static org.mockito.Mockito.*;
File f;
MonthData mData;
+ Row row;
BufferedWriter bw = null;
FileWriter fw = null;
@Before
public void setUp() throws IOException {
mData = new MonthData("env");
+ row = new Row("target", 10,2,1);
f = new File("Monthlyenv.dat");
f.createNewFile();
bw = new BufferedWriter(new FileWriter(f));
mData.notExists(2);
}
+ @Test
+ public void testWrite() throws IOException {
+ mData.write();
+ }
+
+ @Test
+ public void testCompareTo() {
+ Row testrow = new Row("testtar",1,1,1);
+ Assert.assertEquals(-4, row.compareTo(testrow));
+ Assert.assertEquals(0, row.compareTo(row));
+ }
+
+ @Test
+ public void testToString() {
+ Assert.assertEquals("target|10|1|2", row.toString());
+ }
+
@After
public void cleanUp() {
if(f.exists()) {