class Ops {

	public static Object and(TemplateContext ctx, Object value1, final Object value2) {
		if (!Types.toBoolean(ctx, value1)) {
			return value1;
		}

		return value2;
	}

}

class TestOps {

	private TemplateContext ctx;

	@Test
	public void testAnd() {

		assertEquals(10, Ops.and(null, 1, 10));
		assertEquals(1, Ops.and(null, 10, 1));
		assertEquals(10, Ops.and(null, 10, 10));

		assertEquals(null, Ops.and(null, null, 10));
		assertEquals(0, Ops.and(null, 0, 10));
		assertEquals(null, Ops.and(null, 10, null));
		assertEquals(0, Ops.and(null, 10, 0));
	}

}