[Jython-checkins] jython: bytearray JUnit tests: implement getBuilder()
frank.wierzbicki
jython-checkins at python.org
Wed Jun 13 20:44:05 CEST 2012
http://hg.python.org/jython/rev/a1d725ae3712
changeset: 6709:a1d725ae3712
user: Jeff Allen <ja...py at farowl.co.uk>
date: Wed Jun 13 11:43:42 2012 -0700
summary:
bytearray JUnit tests: implement getBuilder()
Missed this change, necessary on addition of BaseBytesBuilder class.
files:
tests/java/org/python/core/BaseBytesTest.java | 27 ++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/tests/java/org/python/core/BaseBytesTest.java b/tests/java/org/python/core/BaseBytesTest.java
--- a/tests/java/org/python/core/BaseBytesTest.java
+++ b/tests/java/org/python/core/BaseBytesTest.java
@@ -738,6 +738,33 @@
return size;
}
+ /**
+ * Construct the MyBytes from a builder object.
+ *
+ * @param builder
+ */
+ protected MyBytes(Builder builder) {
+ super(TYPE);
+ setStorage(builder.getStorage(), builder.getSize());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.python.core.BaseBytes#getBuilder(int)
+ */
+ @Override
+ protected Builder getBuilder(int capacity) {
+ // Return a Builder specialised for my class
+ return new Builder(capacity) {
+
+ @Override
+ MyBytes getResult() {
+ // Create a MyBytes from the storage that the builder holds
+ return new MyBytes(this);
+ }
+ };
+ }
}
/**
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list