@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);
  }
Helper for reading back layers in a {@link BuildContext}.
jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenProjectPropertiesTest.java