mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-07-09 15:28:18 +07:00
Added improved support for injection during tests
This commit is contained in:
@ -28,7 +28,13 @@ public class StatListLabeler {
|
||||
}
|
||||
private int descCount;
|
||||
|
||||
protected StatFormatter formatter = new StatFormatter();
|
||||
protected StatFormatter formatter;
|
||||
|
||||
public StatListLabeler() {}
|
||||
|
||||
public StatListLabeler(StatFormatter formatter) {
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
public CharSequence createDebugLabel(StatListGetter stats, Attributes opAttrs) {
|
||||
builder.setLength(0);
|
||||
|
@ -45,6 +45,10 @@ public class StatListLabelerTest {
|
||||
LogManager.setLevel("com.riiablo.attributes.StatListLabeler", Level.TRACE);
|
||||
}
|
||||
|
||||
private static StatListLabeler newInstance() {
|
||||
return new StatListLabeler(new StatFormatter());
|
||||
}
|
||||
|
||||
private Attributes genCharacterAttrs(byte[] data, int bytesToSkip, int length) {
|
||||
ByteInput in = ByteInput.wrap(Unpooled.wrappedBuffer(data, bytesToSkip, length));
|
||||
BitInput bitInput = in.skipBytes(2).unalign(); // skip signature
|
||||
@ -74,7 +78,7 @@ public class StatListLabelerTest {
|
||||
AttributesUpdater updater = new AttributesUpdater();
|
||||
updater.update(stats, attrs);
|
||||
|
||||
StatListLabeler labeler = new StatListLabeler();
|
||||
StatListLabeler labeler = newInstance();
|
||||
System.out.println(labeler.createLabel(stats.remaining(), attrs));
|
||||
}
|
||||
|
||||
@ -86,7 +90,7 @@ public class StatListLabelerTest {
|
||||
AttributesUpdater updater = new AttributesUpdater();
|
||||
updater.update(stats, attrs);
|
||||
|
||||
StatListLabeler labeler = new StatListLabeler();
|
||||
StatListLabeler labeler = newInstance();
|
||||
System.out.println(labeler.createLabel(stats.remaining(), attrs));
|
||||
}
|
||||
|
||||
@ -98,7 +102,7 @@ public class StatListLabelerTest {
|
||||
AttributesUpdater updater = new AttributesUpdater();
|
||||
updater.update(stats, attrs);
|
||||
|
||||
StatListLabeler labeler = new StatListLabeler();
|
||||
StatListLabeler labeler = newInstance();
|
||||
System.out.println(labeler.createLabel(stats.remaining(), attrs));
|
||||
}
|
||||
|
||||
@ -110,7 +114,7 @@ public class StatListLabelerTest {
|
||||
AttributesUpdater updater = new AttributesUpdater();
|
||||
updater.update(stats, attrs);
|
||||
|
||||
StatListLabeler labeler = new StatListLabeler();
|
||||
StatListLabeler labeler = newInstance();
|
||||
System.out.println("----------");
|
||||
System.out.println(labeler.createDebugLabel(stats.list(ITEM_MAGIC_LIST), attrs));
|
||||
System.out.println("----------");
|
||||
|
Reference in New Issue
Block a user