Implement examples for ASCII Art in Java (#3753)

This commit is contained in:
ocheja
2018-03-04 01:42:05 +09:00
committed by Grzegorz Piwowarek
parent 642d7c2eed
commit 25a118deb3
2 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package com.baeldung.asciiart;
import java.awt.Font;
import org.junit.Test;
import com.baeldung.asciiart.AsciiArt.Settings;
public class AsciiArtTest {
@Test
public void givenTextWithAsciiCharacterAndSettings_shouldPrintAsciiArt() {
AsciiArt asciiArt = new AsciiArt();
String text = "BAELDUNG";
Settings settings = asciiArt.new Settings(new Font("SansSerif", Font.BOLD, 24), text.length() * 30, 30); // 30 pixel width per character
asciiArt.drawString(text, "*", settings);
}
}