Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

PlantUML Macro
titleOppførselen til count()
object "Counter" as counter1 {
	counter = 1
	end = 3
}

counter1 --> counter1 : getCounter() => 1
 
object "Counter" as counter2 {
	counter = 2
	end = 3
}
counter1 --> counter2 : count()
counter2 --> counter2 : getCounter() => 2
 
object "Counter" as counter3 {
	counter = 3
	end = 3
}
counter2 --> counter3 : count()
counter3 --> counter3 : getCounter() => 3
counter3 --> counter3 : count()

Oppførselen til count() og getCounter()

Code Block
languagejava
titleTest Testing av oppførselen til count()
Counter counter = new Counter(1, 3);
if (getCounter() != 1) {
	throw new IllegalStateException("Expected that counter was 1, but actually it was " + getCounter());
}
counter.count();
if (getCounter() != 2) {
	throw new IllegalStateException("Expected that counter was 2, but actually it was " + getCounter());
}
counter.count();
if (getCounter() != 3) {
	throw new IllegalStateException("Expected that counter was 3, but actually it was " + getCounter());
}
counter.count();
if (getCounter() != 3) {
	throw new IllegalStateException("Expected that counter was 3, but actually it was " + getCounter());
}

...

PlantUML Macro
titleOppførselen til count(int)
object "Counter" as counter1 {
	counter = 1
	end = 3
}
 
object "Counter" as counter2 {
	counter = 2
	end = 3
}
counter1 --> counter2 : count(1)
 
object "Counter" as counter3 {
	counter = 3
	end = 3
}
counter2 --> counter3 : count(1)
counter1 --> counter3 : count(2)
counter2 --> counter3 : count(2) 
Oppførselen til count(int)
Code Block
languagejava
titleTest Testing av oppførselen til count(int)
Counter counter = new Counter(1, 3);
counter.count(1);
if (getCounter() != 2) {
	throw new IllegalStateException("Expected that counter was 2, but actually it was " + getCounter());
}
counter.count(1);
if (getCounter() != 3) {
	throw new IllegalStateException("Expected that counter was 3, but actually it was " + getCounter());
}
// test other path
counter = new Counter(1, 3);
counter.count(2);
if (getCounter() != 3) {
	throw new IllegalStateException("Expected that counter was 3, but actually it was " + getCounter());
}
// test yet another path
counter = new Counter(2, 3);
counter.count(2);
if (getCounter() != 3) {
	throw new IllegalStateException("Expected that counter was 3, but actually it was " + getCounter());
}

...