Skip to content

Commit c0ffbe3

Browse files
committed
Test coverage
1 parent 9748c2a commit c0ffbe3

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package test.org.fugerit.java.github.issue.export;
2+
3+
import java.sql.Date;
4+
import java.text.ParseException;
5+
import java.util.Locale;
6+
7+
import org.fugerit.java.github.issue.export.helper.FormatHelper;
8+
import org.junit.Assert;
9+
import org.junit.Test;
10+
11+
public class TestFormatHelper {
12+
13+
@Test
14+
public void testDate() throws ParseException {
15+
String checkDate = "2024-01-01";
16+
String checkDateRes = "01/01/2024 00:00";
17+
String fd = FormatHelper.formatDate( Date.valueOf( checkDate ) , Locale.ENGLISH.getLanguage() );
18+
Assert.assertEquals( checkDateRes , fd);
19+
}
20+
21+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package test.org.fugerit.java.github.issue.export;
2+
3+
import org.fugerit.java.github.issue.export.helper.PoiHelper;
4+
import org.junit.Assert;
5+
import org.junit.Test;
6+
7+
public class TestPoiHelper {
8+
9+
private static final String PAD = "ABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGHABCDEFGH ";
10+
11+
@Test
12+
public void testPrepareCell() {
13+
StringBuffer buffer = new StringBuffer();
14+
int length = 0;
15+
while ( length < PoiHelper.MAX_XLS_CELL_LENGTH ) {
16+
buffer.append( PAD );
17+
length+= PAD.length();
18+
}
19+
String currentCell = PoiHelper.prepareCell( buffer.toString() );
20+
Assert.assertTrue( currentCell.indexOf( "[...]" ) > 0 );
21+
Assert.assertEquals( "" , PoiHelper.prepareCell( "null" ) );
22+
}
23+
24+
}

0 commit comments

Comments
 (0)