| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Friki example source code file (

This example Friki source code file ( is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Friki tags/keywords

file, file, hashmap, io, map, map, policy, policy, policytest, policytest, string, testcase, util

The Friki source code

package tests;

import java.util.*;
import junit.framework.*;

import com.efsol.friki.*;

public class PolicyTest extends TestCase
	private Map map;
	private File tmp;
	private File base;
	private Policy p1;

	public PolicyTest(String name)

	public void setUp()
		map = new HashMap();
		tmp = new File("tmp");
		base = new File("base");
		p1 = new Policy(map, tmp, base);

	public void testMissing()
		assertEquals("PolicyTest.missing 1", null, p1.getObject("hoopla"));

	public void testPresent()
		map.put("hoopla", "dunno");
		assertEquals("PolicyTest.present 1", "dunno", p1.getObject("hoopla"));

	public void testConstructor()
		Policy p2 = new Policy(PolicyHelper.makeMap(new String[] {
		}), tmp, base);
		assertEquals("PolicyTest.constructor 1", null, p2.getObject("hoopla"));
		assertEquals("PolicyTest.constructor 2", "false", p2.getObject("true"));
		assertEquals("PolicyTest.constructor 3", "white", p2.getObject("black"));

Other Friki examples (source code examples)

Here is a short list of links related to this Friki source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.