@Test public void incrementalBuildTypeRenamed() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.fullBuild(); assertThat(metadata).has( Metadata.withProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata).has( Metadata.withProperty("bar.counter").fromSource(BarProperties.class)); assertThat(metadata).doesNotHave(Metadata.withProperty("bar.counter") .fromSource(RenamedBarProperties.class)); project.delete(BarProperties.class); project.add(RenamedBarProperties.class); metadata = project.incrementalBuild(RenamedBarProperties.class); assertThat(metadata).has( Metadata.withProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata).doesNotHave( Metadata.withProperty("bar.counter").fromSource(BarProperties.class)); assertThat(metadata).has(Metadata.withProperty("bar.counter") .fromSource(RenamedBarProperties.class)); }
@Test public void incrementalBuildTypeRenamed() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.fullBuild(); assertThat(metadata, containsProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata, containsProperty("bar.counter").fromSource(BarProperties.class)); assertThat(metadata, not( containsProperty("bar.counter").fromSource(RenamedBarProperties.class))); project.delete(BarProperties.class); project.add(RenamedBarProperties.class); metadata = project.incrementalBuild(RenamedBarProperties.class); assertThat(metadata, containsProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata, not(containsProperty("bar.counter").fromSource(BarProperties.class))); assertThat(metadata, containsProperty("bar.counter").fromSource(RenamedBarProperties.class)); }
@Test public void incrementalBuild() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); assertThat(project.getOutputFile(MetadataStore.METADATA_PATH).exists()).isFalse(); ConfigurationMetadata metadata = project.fullBuild(); assertThat(project.getOutputFile(MetadataStore.METADATA_PATH).exists()).isTrue(); assertThat(metadata).has( Metadata.withProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata).has( Metadata.withProperty("bar.counter").fromSource(BarProperties.class)); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata).has( Metadata.withProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata).has( Metadata.withProperty("bar.counter").fromSource(BarProperties.class)); project.addSourceCode(BarProperties.class, BarProperties.class.getResourceAsStream("BarProperties.snippet")); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata).has(Metadata.withProperty("bar.extra")); assertThat(metadata).has(Metadata.withProperty("foo.counter")); assertThat(metadata).has(Metadata.withProperty("bar.counter")); project.revert(BarProperties.class); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata).isNotEqualTo(Metadata.withProperty("bar.extra")); assertThat(metadata).has(Metadata.withProperty("foo.counter")); assertThat(metadata).has(Metadata.withProperty("bar.counter")); }
@Test public void incrementalBuildAnnotationRemoved() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.fullBuild(); assertThat(metadata).has(Metadata.withProperty("foo.counter")); assertThat(metadata).has(Metadata.withProperty("bar.counter")); project.replaceText(BarProperties.class, "@ConfigurationProperties", "//@ConfigurationProperties"); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata).has(Metadata.withProperty("foo.counter")); assertThat(metadata).isNotEqualTo(Metadata.withProperty("bar.counter")); }
@Test public void incrementalBuild() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); assertFalse(project.getOutputFile(MetadataStore.METADATA_PATH).exists()); ConfigurationMetadata metadata = project.fullBuild(); assertTrue(project.getOutputFile(MetadataStore.METADATA_PATH).exists()); assertThat(metadata, containsProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata, containsProperty("bar.counter").fromSource(BarProperties.class)); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata, containsProperty("foo.counter").fromSource(FooProperties.class)); assertThat(metadata, containsProperty("bar.counter").fromSource(BarProperties.class)); project.addSourceCode(BarProperties.class, BarProperties.class.getResourceAsStream("BarProperties.snippet")); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata, containsProperty("bar.extra")); assertThat(metadata, containsProperty("foo.counter")); assertThat(metadata, containsProperty("bar.counter")); project.revert(BarProperties.class); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata, not(containsProperty("bar.extra"))); assertThat(metadata, containsProperty("foo.counter")); assertThat(metadata, containsProperty("bar.counter")); }
@Test public void incrementalBuildAnnotationRemoved() throws Exception { TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class); ConfigurationMetadata metadata = project.fullBuild(); assertThat(metadata, containsProperty("foo.counter")); assertThat(metadata, containsProperty("bar.counter")); project.replaceText(BarProperties.class, "@ConfigurationProperties", "//@ConfigurationProperties"); metadata = project.incrementalBuild(BarProperties.class); assertThat(metadata, containsProperty("foo.counter")); assertThat(metadata, not(containsProperty("bar.counter"))); }