View Javadoc
1   package org.apache.maven.surefire.booter;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.junit.Test;
23  
24  import java.io.IOException;
25  import java.io.InputStream;
26  import java.io.StringBufferInputStream;
27  
28  import static org.apache.maven.surefire.booter.BooterConstants.PROCESS_CHECKER;
29  import static org.apache.maven.surefire.booter.BooterConstants.PROVIDER_CONFIGURATION;
30  import static org.apache.maven.surefire.booter.BooterConstants.USESYSTEMCLASSLOADER;
31  import static org.apache.maven.surefire.booter.ProcessCheckerType.ALL;
32  import static org.fest.assertions.Assertions.assertThat;
33  
34  /**
35   *
36   */
37  public class BooterDeserializerTest
38  {
39      @Test
40      public void testStartupConfiguration() throws IOException
41      {
42          InputStream is = new StringBufferInputStream( PROCESS_CHECKER + "=all\n"
43                  + USESYSTEMCLASSLOADER + "=true\n"
44                  + PROVIDER_CONFIGURATION + "=abc.MyProvider" );
45  
46          BooterDeserializer deserializer = new BooterDeserializer( is );
47  
48          assertThat( deserializer.getStartupConfiguration().getProcessChecker() )
49                  .isEqualTo( ALL );
50  
51          assertThat( deserializer.getStartupConfiguration().getClassLoaderConfiguration().isUseSystemClassLoader() )
52                  .isTrue();
53  
54          assertThat( deserializer.getStartupConfiguration().getProviderClassName() )
55                  .isEqualTo( "abc.MyProvider" );
56      }
57  }