// Path: src/main/java/org/psidnell/omnifocus/ApplicationContextFactory.java
// public class ApplicationContextFactory {
// 
//     public static final String CONFIG_XML = "/config.xml";
//     private static final String CONFIG_PROPERTIES = "/config.properties";
// 
//     public static ApplicationContext getContext() {
//         return new ClassPathXmlApplicationContext(CONFIG_XML);
//     }
// 
//     public static Properties getConfigProperties() throws IOException {
//         try (
//             InputStream in = ApplicationContextFactory.class.getResourceAsStream(CONFIG_PROPERTIES)) {
//             if (in == null) {
//                 throw new IOException("config not found");
//             }
//             Properties config = new Properties();
//             config.load(in);
//             return config;
//         }
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.psidnell.omnifocus.ApplicationContextFactory;
import org.springframework.context.ApplicationContext;
/*
 * Copyright 2015 Paul Sidnell
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.psidnell.omnifocus.model;



public class ProjectTest {

    private NodeFactory nodeFactory;

    @Before
    public void setup () {
        ApplicationContext appContext = ApplicationContextFactory.getContext();
        nodeFactory = appContext.getBean("nodefactory", NodeFactory.class);
    }

    @Test
    public void testAddTask () {
        Project parent = nodeFactory.createProject("p");
        Task child = nodeFactory.createTask("t");

        parent.add(child);
// Path: src/main/java/org/psidnell/omnifocus/ApplicationContextFactory.java
// public class ApplicationContextFactory {
// 
//     public static final String CONFIG_XML = "/config.xml";
//     private static final String CONFIG_PROPERTIES = "/config.properties";
// 
//     public static ApplicationContext getContext() {
//         return new ClassPathXmlApplicationContext(CONFIG_XML);
//     }
// 
//     public static Properties getConfigProperties() throws IOException {
//         try (
//             InputStream in = ApplicationContextFactory.class.getResourceAsStream(CONFIG_PROPERTIES)) {
//             if (in == null) {
//                 throw new IOException("config not found");
//             }
//             Properties config = new Properties();
//             config.load(in);
//             return config;
//         }
//     }
// }


// Path: src/test/java/org/psidnell/omnifocus/model/ProjectTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.psidnell.omnifocus.ApplicationContextFactory;
import org.springframework.context.ApplicationContext;

/*
 * Copyright 2015 Paul Sidnell
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.psidnell.omnifocus.model;



public class ProjectTest {

    private NodeFactory nodeFactory;

    @Before
    public void setup () {
        ApplicationContext appContext = ApplicationContextFactory.getContext();
        nodeFactory = appContext.getBean("nodefactory", NodeFactory.class);
    }

    @Test
    public void testAddTask () {
        Project parent = nodeFactory.createProject("p");
        Task child = nodeFactory.createTask("t");

        parent.add(child);
        assertEquals (1, parent.getTasks().size());