格式化

package com.eyesmore.ideas;

import java.util.Formatter;

import junit.framework.Assert;
import junit.framework.TestCase;

public class FormatterTest extends TestCase {

	public void testFormat() {
		StringBuilder strBuilder = new StringBuilder();
		Formatter formatter = new Formatter(strBuilder);
		formatter.format("%04X%04X%04X", 8,12,16);
		Assert.assertEquals(strBuilder.toString(), "0008000C0010");
	}
}
 

 

你可能感兴趣的:(java,JUnit)