@@ -0,0 +1,2801 @@
+/*-%0A * Copyright (c) 2014 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.fedoraproject.xmvn.tools.install.condition;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.util.Collections;%0Aimport java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test;%0A%0A/**%0A * @author Mikolaj Izdebski%0A */%0Apublic class BooleanExpressionTest%0A%7B%0A    @Test%0A    public void testBasicExpressions()%0A    %7B%0A        Context context = new Context( Collections.%3CString, String%3E emptyMap() );%0A%0A        BooleanExpression trueExpression = new BooleanLiteral( true );%0A        assertTrue( trueExpression.getValue( context ) );%0A%0A        BooleanExpression falseExpression = new BooleanLiteral( false );%0A        assertFalse( falseExpression.getValue( context ) );%0A%0A        BooleanExpression andExpression = new And( trueExpression, falseExpression );%0A        assertFalse( andExpression.getValue( context ) );%0A%0A        BooleanExpression orExpression = new Or( trueExpression, falseExpression );%0A        assertTrue( orExpression.getValue( context ) );%0A%0A        BooleanExpression xorExpression = new Xor( trueExpression, falseExpression );%0A        assertTrue( xorExpression.getValue( context ) );%0A    %7D%0A%0A    @Test%0A    public void testProperties()%0A    %7B%0A        Map%3CString, String%3E properties = new LinkedHashMap%3C%3E();%0A        properties.put( %22foo%22, %22bar%22 );%0A        properties.put( %22baz%22, %22%22 );%0A        Context context = new Context( properties );%0A%0A        StringExpression fooProperty = new Property( %22foo%22 );%0A        assertEquals( %22bar%22, fooProperty.getValue( context ) );%0A%0A        StringExpression bazProperty = new Property( %22baz%22 );%0A        assertEquals( %22%22, bazProperty.getValue( context ) );%0A%0A        StringExpression xyzzyProperty = new Property( %22xyzzy%22 );%0A        assertEquals( null, xyzzyProperty.getValue( context ) );%0A%0A        BooleanExpression fooDefined = new Defined( %22foo%22 );%0A        assertTrue( fooDefined.getValue( context ) );%0A%0A        BooleanExpression bazDefined = new Defined( %22baz%22 );%0A        assertTrue( bazDefined.getValue( context ) );%0A%0A        BooleanExpression xyzzyDefined = new Defined( %22xyzzy%22 );%0A        assertFalse( xyzzyDefined.getValue( context ) );%0A    %7D%0A%7D%0A

Add tests for installer conditions