View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.shared.release.phase;
20  
21  import org.apache.maven.shared.release.PlexusJUnit4TestCase;
22  import org.apache.maven.shared.release.ReleaseExecutionException;
23  import org.apache.maven.shared.release.ReleaseFailureException;
24  import org.apache.maven.shared.release.ReleaseResult;
25  import org.apache.maven.shared.release.config.ReleaseDescriptorBuilder;
26  import org.apache.maven.shared.release.config.ReleaseUtils;
27  import org.apache.maven.shared.release.env.DefaultReleaseEnvironment;
28  import org.junit.Test;
29  
30  import static org.junit.Assert.assertEquals;
31  
32  /**
33   * Test the the end release phase. Nothing to see here really, but we want to make sure it is configured.
34   *
35   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
36   */
37  public class EndReleasePhaseTest extends PlexusJUnit4TestCase {
38      private ReleasePhase phase;
39  
40      @Override
41      public void setUp() throws Exception {
42          super.setUp();
43  
44          phase = lookup(ReleasePhase.class, "end-release");
45      }
46  
47      @Test
48      public void testExecute() throws ReleaseExecutionException, ReleaseFailureException {
49          ReleaseResult result = phase.execute(
50                  ReleaseUtils.buildReleaseDescriptor(new ReleaseDescriptorBuilder()),
51                  new DefaultReleaseEnvironment(),
52                  null);
53  
54          assertEquals(ReleaseResult.SUCCESS, result.getResultCode());
55      }
56  
57      @Test
58      public void testSimulate() throws ReleaseExecutionException, ReleaseFailureException {
59          ReleaseResult result = phase.simulate(
60                  ReleaseUtils.buildReleaseDescriptor(new ReleaseDescriptorBuilder()),
61                  new DefaultReleaseEnvironment(),
62                  null);
63  
64          assertEquals(ReleaseResult.SUCCESS, result.getResultCode());
65      }
66  }