Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Make Entry.getValue() private
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-archano committed Nov 14, 2016
1 parent fa0d86a commit 8481c27
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Entry {
getValue() as String
}

Object getValue() {
private Object getValue() {
value.call()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BuildPropertiesPluginTest {
}

try {
project.buildProperties.foo['any'].value
project.buildProperties.foo['any'].string
fail('Gradle exception not thrown')
} catch (GradleException e) {
assertThat(e.getMessage()).endsWith('foo.properties does not exist.')
Expand All @@ -63,7 +63,7 @@ public class BuildPropertiesPluginTest {
file project.file('foo.properties'), errorMessage
}
}
project.buildProperties.foo['any'].value
project.buildProperties.foo['any'].string
fail('Gradle exception not thrown')
} catch (GradleException e) {
String message = e.getMessage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class BuildPropertiesTest {

@Test
public void shouldReturnSamePropertyValueInEntries() {
def value = buildProperties['a'].value
def value = buildProperties['a'].string

assertThat(value).isEqualTo(entries['a'].value)
assertThat(value).isEqualTo(entries['a'].string)
}

@Test
Expand All @@ -44,12 +44,12 @@ class BuildPropertiesTest {

@Test
public void shouldReturnDifferentValueFromEntriesWhenPropertyValueOverriddenInProject() {
project.ext.a = 1
project.ext.a = 'x'

def value = buildProperties['a'].value
def value = buildProperties['a'].string

assertThat(value).isNotEqualTo(entries['a'].value)
assertThat(value).isEqualTo(1)
assertThat(value).isNotEqualTo(entries['a'].string)
assertThat(value).isEqualTo('x')
}

static class TestEntries extends Entries {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public class FilePropertiesEntriesTest {

@Test
public void shouldRetrieveValueWhenPropertyDefined() {
def value = entries['aProperty'].value
def value = entries['aProperty'].string

assertThat(value).isEqualTo('qwerty')
}

@Test
public void shouldThrowIllegalArgumentExceptionWhenTryingToAccessValueOfUndefinedProperty() {
try {
entries['notThere'].value
entries['notThere'].string
fail('IllegalArgumentException expected')
} catch (IllegalArgumentException e) {
assertThat(e.getMessage()).startsWith("No value defined for property 'notThere'")
Expand Down Expand Up @@ -103,11 +103,11 @@ public class FilePropertiesEntriesTest {
def includingEntries = FilePropertiesEntries.create(new File(Resources.getResource('including.properties').toURI()))

entries.keys.each { String key ->
assertThat(moreEntries[key].value).isEqualTo(entries[key].value)
assertThat(moreEntries[key].string).isEqualTo(entries[key].string)
}
assertThat(moreEntries['foo'].value).isEqualTo(includingEntries['foo'].value)
assertThat(moreEntries['a'].value).isEqualTo('android')
assertThat(includingEntries['a'].value).isEqualTo('apple')
assertThat(moreEntries['foo'].string).isEqualTo(includingEntries['foo'].string)
assertThat(moreEntries['a'].string).isEqualTo('android')
assertThat(includingEntries['a'].string).isEqualTo('apple')
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public final class EntrySubject extends Subject<EntrySubject, Entry> {
}
}

private Object getEntryValue() {
actual().value
private String getEntryValue() {
actual().string
}

public void willThrow(CompositeException compositeException) {
Expand Down

0 comments on commit 8481c27

Please sign in to comment.