Test Page
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URI;
import java.net.URL;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Currency;
import java.util.Date;
import java.util.Locale;
import java.util.logging.Logger;
import org.apache.commons.lang.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.ubiteck.entity.IEntity;
import com.ubiteck.mobideal.storage.entity.party.Party;
import com.ubiteck.mobideal.storage.type.CompanyType;
/**
*
*/
/**
* @author sursini
*
*/
public class VariousTest //extends TestCase
{
private static final Logger logger = Logger.getLogger(VariousTest.class.getSimpleName());
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
@Test
public void testParseDate() throws Exception{
String dateToParse = "14:01:41 May 13, 2009 PDT";
//String dateToParse = "14:01:41 May 13, 2009";
//SimpleDateFormat bartDateFormat =new SimpleDateFormat("HH:mm:ss MMM dd, yyyy z");
SimpleDateFormat bartDateFormat =new SimpleDateFormat("HH:mm:ss MMM dd, yyyy z",Locale.ENGLISH);
Date paymentDate = bartDateFormat.parse(dateToParse);
System.out.println("PaymentDate ; " + paymentDate);
}
/*
@Test
public void testParseInt(){
int value = Integer.parseInt("3 ");
System.out.println("value :" + value);
}
*/
@Test
public void testClassIdentification(){
//assertTrue (Party.class.isInstance(IEntity.class));
//assertTrue (IEntity.class.isInstance(Party.class));
assertTrue (IEntity.class.isAssignableFrom(Party.class));
//assertTrue (IEntity.class.isAssignableFrom(Logger.class));
//assertTrue (Party.class.isAssignableFrom(IEntity.class));
}
@Test
public void testStringUtils(){
logger.finest(StringUtils.rightPad("AAAA", 15," ") +" (Ok)");
logger.finest(new File(".").getAbsolutePath());
Class<?> c = this.getClass();
URL url = c.getResource(c.getName() + ".class");
logger.finest("url : " + url);
url = c.getResource(".");
logger.finest("url : " + url);
}
@Test
public void testLocale(){
Locale locale = Locale.FRENCH;
logger.finest("locale : " + locale.getISO3Language());
logger.finest("locale language: " + locale.getLanguage());
}
@Test
public void testFormatCurrency(){
Locale locale = new Locale("fr","CH");
NumberFormat n = NumberFormat.getCurrencyInstance(locale);
BigDecimal big = new BigDecimal("17.00000000000000000000");
logger.finest("formatted : " + n.format(big));
}
@Test
public void testFormatCurrencyWithLocale(){
Locale locale = new Locale("fr","CH");
NumberFormat n = NumberFormat.getCurrencyInstance(locale);
Currency currency = Currency.getInstance("USD");
BigDecimal big = new BigDecimal("17.00000000000000000000");
logger.finest("formatted : " + n.format(big));
n.setCurrency(Currency.getInstance("USD"));
logger.finest("formatted (usd) : " + n.format(big));
n.setCurrency(Currency.getInstance("CHF"));
logger.finest("formatted (usd) : " + n.format(big));
}
/*
@Test
public void testChrono(){
Chrono chrono = Chrono.start();
try {
Thread.sleep(3000);
logger.finest("elapsed : " + chrono.getElapsed());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
*/
@Test
public void testDateConversion(){
String datevalue ="20100125 17:35:08.000000 +0100";
String format = "yyyyMMdd HH:mm:ss.SSSSSS Z";
DateFormat dateFormat = new SimpleDateFormat(format);
//Date date = new Date(datevalue); //convert your date time to msec
//dateFormat.format(date);
try {
Date retrieved = dateFormat.parse(datevalue);
String result = dateFormat.format(retrieved);
assertEquals(datevalue, result);
} catch (ParseException e) {
e.printStackTrace();
fail (e.getMessage());
}
}
@Test
public void testBigDecimalDivision(){
BigDecimal amount = new BigDecimal("190.666500");
BigDecimal divisor = new BigDecimal("43");
BigDecimal result = amount.divide(divisor,RoundingMode.HALF_UP).setScale(3,RoundingMode.HALF_UP);
logger.finest(" Result : " + result);
}
@Test
public void testCurrencySymbol(){
Currency curr = Currency.getInstance("EUR");
logger.finest(" Result : " + curr);
logger.finest(" Result : " + curr.getSymbol());
logger.finest(" Result 1: " + Currency.getInstance("EUR").getSymbol());
logger.finest(" Result 2: " + Currency.getInstance("EUR").getSymbol(Locale.ENGLISH));
logger.finest(" Result 2: " + Currency.getInstance("EUR").getSymbol(Locale.ENGLISH));
logger.finest(" Result 3: " + Currency.getInstance("USD").getSymbol(Locale.ENGLISH));
logger.finest(" Result 3: " + Currency.getInstance("USD").getSymbol());
logger.finest(" Result 3: " + Currency.getInstance("EUR").getSymbol(new Locale("es_ES")));
//logger.finest(" Result 3: " + Currency.getInstance(Locale.ENGLISH).getInstance("EUR").getSymbol());
Currency dollars = Currency.getInstance("USD");
logger.finest(" Result 3: " +dollars.getSymbol());
Currency pounds = Currency.getInstance(Locale.UK);
logger.finest(" Result 3: " +pounds.getSymbol());
NumberFormat germanFormat = NumberFormat.getCurrencyInstance(Locale.GERMANY);
logger.finest(germanFormat.getCurrency().getSymbol());
}
@Test
public void testCompanyType(){
for (CompanyType companyType : CompanyType.values()) {
logger.finest("Company type ordinale : " +companyType.toString() + companyType.ordinal());
}
//logger.finest("Company type ordinale : " + CompanyType.MANUFACTURER.ordinal());
}
@Test
public void testCurrency(){
logger.finest("Locale : " + Locale.FRANCE);
Locale locale = Locale.FRANCE;
Currency retrieved = Currency.getInstance(locale);
logger.finest("Curency : " + retrieved);
locale = new Locale("fr","CH");
logger.finest("Locale fr: " + locale);
retrieved = Currency.getInstance(locale);
logger.finest("Curency : " + retrieved);
}
@Test
public void testClassPath(){
System.out.print(System.getProperty("java.library.path"));
}
}
eureka
jb Type
test quote
This is your information here
Some content here
Your bold text is here
test quote
1 Point 1
{/jb_br}
2 Point 2
1 Point 1 Point 1
2 Point 2
Quote left
Black box content
eg
| 1 | 2 |
|
2 |
Blue disc |
|
1 Point 1 |
Red Disc |
private static final Logger logger = Logger.getLogger(VariousTest.class.getSimpleName());
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}
test
Tags: content , test , page , type , information , quote