Repository: GoogleContainerTools/jib
File: jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenProjectPropertiesTest.java (Java)

Code before:
              () ->
                  mavenProjectProperties.createJibContainerBuilder(
                      mockJavaContainerBuilder, containerizingMode));
      Assert.assertEquals(thrownException.getMessage(), expectedMessage);
    }
  }

  @Test
  public void
      testCreateContainerBuilder_exceptionMessageHasCompileSuggestionIfProjectIsExplodedAndNotWar()
          throws IOException {
    String expectedMessage =
        "Obtaining project build output files failed; make sure you have "
            + "compiled your project before trying to build the image. (Did you accidentally run \"mvn clean "
            + "jib:build\" instead of \"mvn clean compile jib:build\"?)";

    when(mockMavenProject.getPackaging()).thenReturn("jar");
    when(mockJavaContainerBuilder.addResources(any(), any())).thenThrow(IOException.class);

    IOException thrownException =
        Assert.assertThrows(
            IOException.class,
            () ->
                mavenProjectProperties.createJibContainerBuilder(
                    mockJavaContainerBuilder, ContainerizingMode.EXPLODED));
    Assert.assertEquals(thrownException.getMessage(), expectedMessage);
  }

  @Test
  public void testCreateContainerBuilder_noErrorIfWebInfClassesDoesNotExist()
      throws IOException, InvalidImageReferenceException {
    temporaryFolder.newFolder("final-name", "WEB-INF", "lib");
    setUpWar(temporaryFolder.getRoot().toPath());

    assertThat(
            mavenProjectProperties.createJibContainerBuilder(
                JavaContainerBuilder.from("ignored"), ContainerizingMode.EXPLODED))
        .isNotNull();
  }

  @Test
  public void testIsWarProject_warPackagingIsWar() {
    when(mockMavenProject.getPackaging()).thenReturn("war");
    assertThat(mavenProjectProperties.isWarProject()).isTrue();
  }

  @Test
  public void testIsWarProject_gwtAppPackagingIsWar() {
    when(mockMavenProject.getPackaging()).thenReturn("gwt-app");
    assertThat(mavenProjectProperties.isWarProject()).isTrue();
  }

Review comment (suggestion):
```suggestion
    assertThat(thrownException).hasMessageThat().isEqualTo(expectedMessage);
```

Code after:
              () ->
                  mavenProjectProperties.createJibContainerBuilder(
                      mockJavaContainerBuilder, containerizingMode));
      assertThat(thrownException).hasMessageThat().isEqualTo(expectedMessage);
    }
  }

  @Test
  public void
      testCreateContainerBuilder_exceptionMessageHasCompileSuggestionIfProjectIsExplodedAndNotWar()
          throws IOException {
    String expectedMessage =
        "Obtaining project build output files failed; make sure you have "
            + "compiled your project before trying to build the image. (Did you accidentally run \"mvn clean "
            + "jib:build\" instead of \"mvn clean compile jib:build\"?)";

    when(mockMavenProject.getPackaging()).thenReturn("jar");
    when(mockJavaContainerBuilder.addResources(any(), any())).thenThrow(IOException.class);

    IOException thrownException =
        assertThrows(
            IOException.class,
            () ->
                mavenProjectProperties.createJibContainerBuilder(
                    mockJavaContainerBuilder, ContainerizingMode.EXPLODED));
    assertThat(thrownException).hasMessageThat().isEqualTo(expectedMessage);
  }

  @Test
  public void testCreateContainerBuilder_noErrorIfWebInfClassesDoesNotExist()
      throws IOException, InvalidImageReferenceException {
    temporaryFolder.newFolder("final-name", "WEB-INF", "lib");
    setUpWar(temporaryFolder.getRoot().toPath());

    assertThat(
            mavenProjectProperties.createJibContainerBuilder(
                JavaContainerBuilder.from("ignored"), ContainerizingMode.EXPLODED))
        .isNotNull();
  }

  @Test
  public void testIsWarProject_warPackagingIsWar() {
    when(mockMavenProject.getPackaging()).thenReturn("war");
    assertThat(mavenProjectProperties.isWarProject()).isTrue();
  }

  @Test
  public void testIsWarProject_gwtAppPackagingIsWar() {
    when(mockMavenProject.getPackaging()).thenReturn("gwt-app");
    assertThat(mavenProjectProperties.isWarProject()).isTrue();
  }