Skip to content

Commit

Permalink
#617 Removed method YamlLines.original()
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Apr 4, 2024
1 parent d763bd2 commit cfa8299
Show file tree
Hide file tree
Showing 17 changed files with 1 addition and 162 deletions.
5 changes: 0 additions & 5 deletions src/main/java/com/amihaiemil/eoyaml/AllYamlLines.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ public String toString() {
return builder.toString();
}

@Override
public Collection<YamlLine> original() {
return this.lines;
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
final YamlNode node;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/amihaiemil/eoyaml/Backwards.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ final class Backwards implements YamlLines {
this.lines = lines;
}

@Override
public Collection<YamlLine> original() {
return this.lines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.lines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/CollapsedFlowLines.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -96,11 +95,6 @@ final class CollapsedFlowLines implements YamlLines {
this.closingBracket = closingBracket;
}

@Override
public Collection<YamlLine> original() {
return this.lines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.lines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/FirstCommentFound.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -88,11 +87,6 @@ public Iterator<YamlLine> iterator() {
return iterator;
}

@Override
public Collection<YamlLine> original() {
return this.lines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.lines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/GreaterIndentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -90,11 +89,6 @@ public Iterator<YamlLine> iterator() {
return iterator;
}

@Override
public Collection<YamlLine> original() {
return this.yamlLines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.yamlLines.nextYamlNode(prev);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/amihaiemil/eoyaml/ReadYamlStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public Collection<YamlNode> values() {
final List<YamlNode> values = new ArrayList<>();
for(final YamlLine startDoc : this.startMarkers) {
final YamlLines document = this.readDocument(startDoc);
if(!document.original().isEmpty()) {
if(document.iterator().hasNext()) {
values.add(
document.nextYamlNode(startDoc)
);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/SameIndentationLevel.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -111,11 +110,6 @@ public Iterator<YamlLine> iterator() {
return iterator;
}

@Override
public Collection<YamlLine> original() {
return this.yamlLines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.yamlLines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/Skip.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -89,11 +88,6 @@ public Iterator<YamlLine> iterator() {
return iterator;
}

@Override
public Collection<YamlLine> original() {
return this.yamlLines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.yamlLines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/StartMarkers.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
package com.amihaiemil.eoyaml;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -97,11 +96,6 @@ public Iterator<YamlLine> iterator() {
return iterator;
}

@Override
public Collection<YamlLine> original() {
return this.yamlLines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.yamlLines.nextYamlNode(prev);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/amihaiemil/eoyaml/WellIndented.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import com.amihaiemil.eoyaml.exceptions.YamlIndentationException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -144,11 +143,6 @@ public Iterator<YamlLine> iterator() {
return wellIndented.iterator();
}

@Override
public Collection<YamlLine> original() {
return this.yamlLines.original();
}

@Override
public YamlNode nextYamlNode(final YamlLine prev) {
return this.yamlLines.nextYamlNode(prev);
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/amihaiemil/eoyaml/YamlLines.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
*/
package com.amihaiemil.eoyaml;

import java.util.Collection;
import java.util.Iterator;

/**
Expand All @@ -38,17 +37,6 @@
*/
interface YamlLines extends Iterable<YamlLine> {

/**
* Return all the original underlying lines. No matter what
* decorators are added on top of the base YamlLines implementation,
* the call to this method should always be delegated down to the
* base method, with no changes.
* @return The original YamlLines as a Collection.
* @todo #615:30min Remove this method, it is not needed anymore.
*/
@Deprecated
Collection<YamlLine> original();

/**
* Fetch the next YamlNode.
* @param prev Previous YamlLine - line before the node start.
Expand Down
15 changes: 0 additions & 15 deletions src/test/java/com/amihaiemil/eoyaml/BackwardsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.mockito.Mockito;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand All @@ -45,20 +44,6 @@
*/
public final class BackwardsTest {

/**
* Backwards delegates the call to originals().
*/
@Test
public void delegatesOriginals() {
final YamlLines initial = Mockito.mock(YamlLines.class);
final Collection<YamlLine> lines = Mockito.mock(Collection.class);
Mockito.when(initial.original()).thenReturn(lines);
MatcherAssert.assertThat(
new Backwards(initial).original(),
Matchers.is(lines)
);
}

/**
* Backwards delegates the call to toYamlNode().
*/
Expand Down
14 changes: 0 additions & 14 deletions src/test/java/com/amihaiemil/eoyaml/FirstCommentFoundTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.mockito.Mockito;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand All @@ -44,19 +43,6 @@
* @since 4.2.0
*/
public final class FirstCommentFoundTest {
/**
* FirstCommentFound delegates the call to originals().
*/
@Test
public void delegatesOriginals() {
final YamlLines initial = Mockito.mock(YamlLines.class);
final Collection<YamlLine> lines = Mockito.mock(Collection.class);
Mockito.when(initial.original()).thenReturn(lines);
MatcherAssert.assertThat(
new FirstCommentFound(initial).original(),
Matchers.is(lines)
);
}

/**
* FirstCommentFound delegates the call to toYamlNode().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,6 @@
* @since 3.0.2
*/
public final class SameIndentationLevelTestCase {

/**
* SameIndentationLevel should return all the lines
* that it encapsulates.
*/
@Test
public void fetchesTheLines() {
final List<YamlLine> lines = new ArrayList<>();
lines.add(new RtYamlLine("first: somethingElse", 0));
lines.add(new RtYamlLine("second: ", 1));
lines.add(new RtYamlLine(" fourth: some", 2));
lines.add(new RtYamlLine(" fifth: values", 3));
lines.add(new RtYamlLine("third: something", 4));
final YamlLines yaml = new SameIndentationLevel(
new AllYamlLines(lines)
);
MatcherAssert.assertThat(
yaml.original().size(),
Matchers.equalTo(lines.size())
);
}

/**
* SameIndentationLevel should iterate only over the lines,
Expand Down
15 changes: 0 additions & 15 deletions src/test/java/com/amihaiemil/eoyaml/SkipTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.mockito.Mockito;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -145,20 +144,6 @@ public void skipsNoLines() {
);
}

/**
* Skip delegates the call to originals().
*/
@Test
public void delegatesOriginals() {
final YamlLines initial = Mockito.mock(YamlLines.class);
final Collection<YamlLine> lines = Mockito.mock(Collection.class);
Mockito.when(initial.original()).thenReturn(lines);
MatcherAssert.assertThat(
new Skip(initial).original(),
Matchers.is(lines)
);
}

/**
* Skip delegates the call to toYamlNode().
*/
Expand Down
16 changes: 0 additions & 16 deletions src/test/java/com/amihaiemil/eoyaml/StartMarkersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.mockito.Mockito;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

Expand All @@ -45,21 +44,6 @@
*/
public final class StartMarkersTest {

/**
* StartMarkers can return the encapsulated lines.
*/
@Test
@SuppressWarnings("unchecked")
public void returnsLines() {
final YamlLines lines = Mockito.mock(YamlLines.class);
final Collection<YamlLine> collection = Mockito.mock(Collection.class);
Mockito.when(lines.original()).thenReturn(collection);
MatcherAssert.assertThat(
new StartMarkers(lines).original(),
Matchers.is(collection)
);
}

/**
* StartMarkers can turn itself into YamlNode.
*/
Expand Down
16 changes: 0 additions & 16 deletions src/test/java/com/amihaiemil/eoyaml/WellIndentedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import com.amihaiemil.eoyaml.exceptions.YamlIndentationException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.hamcrest.MatcherAssert;
Expand All @@ -47,21 +46,6 @@
*/
public final class WellIndentedTest {

/**
* WellIndented can return the encapsulated lines.
*/
@Test
@SuppressWarnings("unchecked")
public void returnsLines() {
final YamlLines lines = Mockito.mock(YamlLines.class);
final Collection<YamlLine> collection = Mockito.mock(Collection.class);
Mockito.when(lines.original()).thenReturn(collection);
MatcherAssert.assertThat(
new WellIndented(lines).original(),
Matchers.is(collection)
);
}

/**
* WellIndented can turn itself into YamlNode.
*/
Expand Down

1 comment on commit cfa8299

@zoeself
Copy link
Collaborator

@zoeself zoeself commented on cfa8299 Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amihaiemil I've closed the Issues [#617] since their to-dos disappeared from the code.

The to-dos may have been removed in an earlier commit, but I've found it just now.

Please sign in to comment.