(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestSubjectIterator(t *testing.T) { |
| 72 | // Create some subjects |
| 73 | subject1 := &base.Subject{Type: "user", Id: "u1"} |
| 74 | subject2 := &base.Subject{Type: "user", Id: "u2"} |
| 75 | subject3 := &base.Subject{Type: "user", Id: "u3"} |
| 76 | |
| 77 | // Create a subject collection and add the subjects |
| 78 | subjectCollection := NewSubjectCollection(subject1, subject2, subject3) |
| 79 | |
| 80 | // Create a subject iterator |
| 81 | subjectIterator := subjectCollection.CreateSubjectIterator() |
| 82 | |
| 83 | // Test HasNext() and GetNext() methods |
| 84 | if !subjectIterator.HasNext() { |
| 85 | t.Error("Expected true for HasNext(), but got false") |
| 86 | } |
| 87 | if subjectIterator.GetNext() != subject1 { |
| 88 | t.Error("Expected subject1 for GetNext(), but got something else") |
| 89 | } |
| 90 | if !subjectIterator.HasNext() { |
| 91 | t.Error("Expected true for HasNext(), but got false") |
| 92 | } |
| 93 | if subjectIterator.GetNext() != subject2 { |
| 94 | t.Error("Expected subject2 for GetNext(), but got something else") |
| 95 | } |
| 96 | if !subjectIterator.HasNext() { |
| 97 | t.Error("Expected true for HasNext(), but got false") |
| 98 | } |
| 99 | if subjectIterator.GetNext() != subject3 { |
| 100 | t.Error("Expected subject3 for GetNext(), but got something else") |
| 101 | } |
| 102 | if subjectIterator.HasNext() { |
| 103 | t.Error("Expected false for HasNext(), but got true") |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | func TestUniqueTupleIterator(t *testing.T) { |
| 108 | // Create some tuples |
nothing calls this directly
no test coverage detected