Skip to content

Commit

Permalink
UnitqueIdParts can split
Browse files Browse the repository at this point in the history
  • Loading branch information
jlink committed Nov 2, 2015
1 parent 073bbb3 commit 8094382
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Expand Up @@ -40,8 +40,9 @@ public void resolveElement(TestPlanSpecificationElement element) {
private void resolveUniqueIdSpecification(UniqueIdSpecification element) { private void resolveUniqueIdSpecification(UniqueIdSpecification element) {
UniqueIdParts uniqueIdParts = new UniqueIdParts(element.getUniqueId()); UniqueIdParts uniqueIdParts = new UniqueIdParts(element.getUniqueId());
Preconditions.condition(element.getUniqueId().equals(uniqueIdParts.rest()), Preconditions.condition(element.getUniqueId().equals(uniqueIdParts.rest()),
"Unique ID is: " + uniqueIdParts.rest()); "UniqueId is: " + uniqueIdParts.rest());
String engingeId = uniqueIdParts.pop(); String engineId = uniqueIdParts.pop();
Preconditions.condition(root.getUniqueId().equals(engineId), "Engine ID is: " + engineId);
TestDescriptor descriptor = new UniqueIdTestDescriptorResolver().resolve(root, element); TestDescriptor descriptor = new UniqueIdTestDescriptorResolver().resolve(root, element);
if (descriptor != null) { if (descriptor != null) {
testDescriptors.add(descriptor); testDescriptors.add(descriptor);
Expand Down
Expand Up @@ -24,11 +24,19 @@ public UniqueIdParts(String uniqueId) {
} }


private void splitIntoParts(String uniqueId) { private void splitIntoParts(String uniqueId) {
parts.add(uniqueId); String currentPart = "";
for (char c : uniqueId.toCharArray()) {
if (SEPARATORS.contains(Character.toString(c))) {
parts.add(currentPart);
currentPart = "";
}
currentPart += c;
}
parts.add(currentPart);
} }


public String pop() { public String pop() {
return null; return parts.remove(0);
} }


public String rest() { public String rest() {
Expand Down

0 comments on commit 8094382

Please sign in to comment.