1   package com.atlassian.maven.plugins.amps.product;
2   
3   import java.net.URISyntaxException;
4   
5   import org.junit.Test;
6   
7   import static org.junit.Assert.assertEquals;
8   
9   public class CrowdProductHandlerTest
10  {
11      @Test
12      public void crowdServerUriConvertedToUseLocalhost() throws URISyntaxException
13      {
14          String uri = "http://example.test:8080/prefix/crowd?query#fragment";
15          assertEquals("http://localhost:8080/prefix/crowd?query#fragment", CrowdProductHandler.withLocalhostAsHostname(uri));
16      }
17  
18      @Test
19      public void crowdServerUriConvertedToUseLocalhostWithHttps() throws URISyntaxException
20      {
21          String uri = "https://example.test:8080/prefix/crowd?query#fragment";
22          assertEquals("https://localhost:8080/prefix/crowd?query#fragment", CrowdProductHandler.withLocalhostAsHostname(uri));
23      }
24  }