}
- // Reset the current value to the initial value.
- public synchronized void reset() {
- Collections.copy(this.currentValue, this.initialValue);
- }
-
// Returns the initial value.
public synchronized String getInitialID() {
return getIDString(this.initialValue);
// Set the current value.
this.currentValue = new Vector<Character>(v);
+
}
+
+ // Reset the current value to the initial value.
+ public synchronized void resetID() {
+ Collections.copy(this.currentValue, this.initialValue);
+ }
+
// Returns the next alphabetic ID in the sequence.
//
//
// See the TODOs at the top of this class for additional
// functionality that needs to be implemented.
- public synchronized String getNextID() {
+ public synchronized String nextID() {
// Get next values for each character, from right to left
// (least significant to most significant).
}
// Returns a String representation of the ID, by appending
- // the String values of each character in the Vector.
+ // the String values of each character.
public synchronized String getIDString(Vector<Character> v) {
StringBuffer sb = new StringBuffer();
for ( Character ch : v ) {
public interface IDGenerator {
- public void reset();
-
+ // Returns the initial value of the ID.
public String getInitialID();
+ // Gets the current value of an ID.
public String getCurrentID();
+ // Sets the current value of an ID.
public void setCurrentID(String value);
- public String getNextID();
+ // Resets an ID to its initial value.
+ public void resetID();
+
+ // Returns the next ID in the sequence, and sets
+ // the current value to that ID.
+ public String nextID();
+ // Validates an ID against a pattern of generated IDs.
public boolean isValidID(String value);
+ // Returns a String representation of the regular expression ("regex")
+ // pattern used to validate instance values of generated IDs.
public String getRegex();
}
this.generator = idGenerator;
}
- // Resets the ID to its initial value.
- public synchronized void reset() {
- generator.reset();
- }
-
- // Returns the initial value of this ID.
+ // Returns the initial value of the ID associated with this IDPart.
public synchronized String getInitialID() {
return generator.getInitialID();
}
- // Returns the current value of this ID.
+ // Returns the current value of the ID associated with this IDPart.
public synchronized String getCurrentID() {
return generator.getCurrentID();
}
- // Sets the current value of this ID.
+ // Sets the current value of the ID associated with this IDPart.
public synchronized void setCurrentID(String value) {
generator.setCurrentID(value);
}
- // Returns the next value of this ID.
- public synchronized String getNextID() throws IllegalStateException {
- return generator.getNextID();
+ // Resets the ID associated with this IDPart to its initial value.
+ public synchronized void resetID() {
+ generator.resetID();
+ }
+
+ // Returns the next ID in the sequence, and sets the current value
+ // of the ID associated with this IDPart to that next ID.
+ public synchronized String nextID() throws IllegalStateException {
+ return generator.nextID();
}
- // Validates an instance of the ID, to
- // identify if it matches this IDPart's pattern.
+ // Validates a supplied ID against the pattern of this IDPart.
//
// Some IDParts may offer generic validation,
// while others may offer per-instance valiadation
return generator.isValidID(value);
}
- // Returns a regular expression pattern used for ID validation.
+ // Returns a String representation of the regular expression ("regex")
+ // pattern used to validate instance values of this IDPart.
public synchronized String getRegex() {
return generator.getRegex();
}
// Returns the current value of this ID, given a
// supplied ID that partly matches the pattern.
//
- // This will result in an ID that matches
- // the supplied ID, with an optional next ID component
- // that reflects the initial ID of that component.
- // (E.g. "2009.5." becomes "2009.5.1", if the next
- // ID component is an incrementing numeric IDPart.)
+ // If the supplied ID fully matches the pattern,
+ // will return the supplied ID.
//
- // @TODO: Throws IllegalArgumentException
- public synchronized String getCurrentID(String value) {
+ // However, if the supplied ID is a partial ID, which
+ // partly "stem-matches" the pattern but does not
+ // ully match the pattern, will return the partial ID with
+ // its next ID component appended. The next ID component
+ // will be set to its initial value.
+ //
+ // Examples:
+ // * 2009.5." becomes "2009.5.1", in a case where the
+ // next ID component is an incrementing numeric IDPart.
+ // * "E55-" becomes "E55-a", where the next ID component
+ // is an incrementing alphabetic IDPart.
+ public synchronized String getCurrentID(String value)
+ throws IllegalArgumentException {
if (value == null) return value;
}
}
- // If the supplied ID doesn't entirely match the pattern,
- // return the supplied ID as the next ID.
- //
- // @TODO: We may wish to handle this differently,
- // such as by throwing an Exception.
+ // If the supplied ID doesn't partly match the pattern,
+ // throw an Exception.
if (matchedParts == 0) {
- // return value;
- return "foo1";
+ throw new IllegalArgumentException("Supplied ID does not match this ID pattern.");
}
pattern = Pattern.compile(regex.toString());
matcher = pattern.matcher(value);
- // If the supplied ID doesn't entirely match the pattern,
- // return the supplied ID as the next ID.
- //
- // @TODO: We may wish to handle this differently,
- // such as by throwing an Exception.
+ // If the supplied ID doesn't match the pattern built above,
+ // throw an Exception. (This error condition should likely
+ // never be reached, but it's here as a guard.)
if (! matcher.matches()) {
- // return value;
- return "foo2";
+ throw new IllegalArgumentException("Supplied ID does not match this ID pattern.");
}
- // Temporary for debugging
- // return regex.toString();
-
- // Otherwise, if the supplied ID partly matches the pattern,
- // split the ID into its components and store those values in
- // each of the pattern's IDParts.
+ // Otherwise, if the supplied ID matches the pattern,
+ // split the ID into its components and store those
+ // values in each of the pattern's IDParts.
IDPart currentPart;
for (int i = 1; i <= matchedParts; i++) {
currentPart = this.parts.get(i - 1);
currentPart.setCurrentID(matcher.group(i));
}
- // Obtain the initial value of the next IDPart,
- // and set the current value of that part to its initial value.
+ // Obtain the initial value of the next IDPart, and
+ // set the current value of that part to its initial value.
//
// If the supplied ID fully matches the pattern, there will
- // be no 'next' IDPart, and an Exception will be thrown.
+ // be no 'next' IDPart, and we must catch that Exception below.
int nextPartNum = matchedParts;
try {
String initial = this.parts.get(nextPartNum).getInitialID();
this.parts.get(nextPartNum).setCurrentID(initial);
+ // Increment the number of matched parts to reflect the
+ // addition of this next IDPart.
matchedParts++;
} catch (ArrayIndexOutOfBoundsException e ) {
// Do nothing here; we simply won't increment
- // the number of matched parts for the loop below.
+ // the number of matched parts, used in the loop below.
}
// Call the getCurrentID() method on each of the
// supplied IDParts, as well as on the added IDPart
- // whose current value was just obtained, if any.
+ // whose initial value was just obtained, if any.
StringBuffer sb = new StringBuffer();
for (int i = 1; i <= matchedParts; i++) {
sb.append(this.parts.get(i - 1).getCurrentID());
}
- // Returns the next value of this ID.
- //
- // @TODO: Throws IllegalArgumentException
- public synchronized String getNextID() {
+ // Returns the next value of this ID, and sets the current value to that ID.
+ public synchronized String nextID() throws IllegalStateException {
// Obtain the last (least significant) IDPart,
- // and call its getNextID() method, which will
+ // and call its nextID() method, which will
// concurrently set the current value of that ID
// to the next ID.
int lastPartNum = this.parts.size() - 1;
- this.parts.get(lastPartNum).getNextID();
+ this.parts.get(lastPartNum).nextID();
// Then call the getCurrentID() method on all of the IDParts
StringBuffer sb = new StringBuffer(MAX_ID_LENGTH);
}
// Returns the next value of this ID, given a
- // supplied ID that entirely matches the pattern.
- //
- // @TODO: Throws IllegalArgumentException
- public synchronized String getNextID(String value) {
+ // supplied ID that entirely matches the pattern,
+ // and sets the current value to that ID.
+ public synchronized String nextID(String value)
+ throws IllegalStateException, IllegalArgumentException {
- if (value == null) return value;
+ if (value == null) {
+ throw new IllegalArgumentException("Supplied ID cannot be null.");
+ }
Pattern pattern = Pattern.compile(getRegex());
Matcher matcher = pattern.matcher(value);
// If the supplied ID doesn't entirely match the pattern,
- // return the supplied ID as the next ID.
- //
- // @TODO: We may wish to handle this differently,
- // such as by throwing an Exception.
+ // throw an Exception.
if (! matcher.matches()) {
- return value;
+ throw new IllegalArgumentException("Supplied ID does not match this ID pattern.");
}
// Otherwise, if the supplied ID entirely matches the pattern,
}
// Obtain the last (least significant) IDPart,
- // and call its getNextID() method, which will
+ // and call its nextID() method, which will
// concurrently set the current value of that ID
// to the next ID.
//
- // @TODO: This code is duplicated in getNextID(), above,
+ // @TODO: This code is duplicated in nextID(), above,
// and thus we may want to refactor this.
int lastPartNum = this.parts.size() - 1;
- this.parts.get(lastPartNum).getNextID();
+ this.parts.get(lastPartNum).nextID();
// Then call the getCurrentID() method on all of the IDParts
StringBuffer sb = new StringBuffer();
// Validates a provided ID against the pattern.
//
- // @TODO May potentially throw at least one pattern-related exception.
+ // @TODO May potentially throw at least one pattern-related exception;
+ // we'll need to catch and handle this.
public synchronized boolean isValidID(String value) {
if (value == null) return false;
}
- public synchronized void reset() {
- this.currentValue = this.initialValue;
- }
-
public synchronized String getInitialID() {
return Long.toString(this.initialValue);
}
return Long.toString(this.currentValue);
}
- // Sets the current value.
+ // Sets the current value of the ID.
public synchronized void setCurrentID(String value) throws IllegalArgumentException {
// @TODO Much of this code is copied from the main constructor,
this.maxLength = DEFAULT_MAX_LENGTH;
}
- public synchronized String getNextID() throws IllegalStateException {
+ public synchronized void resetID() {
+ this.currentValue = this.initialValue;
+ }
+
+ // Returns the next ID in the sequence, and sets the current value to that ID.
+ public synchronized String nextID() throws IllegalStateException {
this.currentValue++;
String nextID = Long.toString(this.currentValue);
if (nextID.length() > this.maxLength) {
}
- public synchronized void reset() {
- // Do nothing
- }
-
public synchronized String getInitialID() {
return this.initialValue;
}
this.currentValue = value;
}
- public synchronized String getNextID() {
+ public synchronized void resetID() {
+ // Do nothing
+ }
+
+ public synchronized String nextID() {
return this.currentValue;
}
}
- public synchronized void reset() {
- this.currentValue = this.initialValue;
- }
-
public synchronized String getInitialID() {
return this.initialValue;
}
}
+ public synchronized void resetID() {
+ this.currentValue = this.initialValue;
+ }
+
// @TODO: We'll need to decide what a "next" ID means in the context of:
// - An initially supplied value.
// - A year value that has not changed from its previous value.
// - A year value that has changed, as a result of a rollover
// to a new instant in time.
- public synchronized String getNextID() {
+ public synchronized String nextID() {
return this.currentValue;
}
IDPart part;
- public void testGetNextIDLowercase() {
+ public void testnextIDLowercase() {
part = new AlphabeticIDPart("a");
- assertEquals("b", part.getNextID());
- assertEquals("c", part.getNextID());
+ assertEquals("b", part.nextID());
+ assertEquals("c", part.nextID());
part = new AlphabeticIDPart("x");
- assertEquals("y", part.getNextID());
- assertEquals("z", part.getNextID());
+ assertEquals("y", part.nextID());
+ assertEquals("z", part.nextID());
}
- public void testGetNextIDLowercase2Chars() {
+ public void testnextIDLowercase2Chars() {
part = new AlphabeticIDPart("aa");
- assertEquals("ab", part.getNextID());
- assertEquals("ac", part.getNextID());
+ assertEquals("ab", part.nextID());
+ assertEquals("ac", part.nextID());
part = new AlphabeticIDPart("zx");
- assertEquals("zy", part.getNextID());
- assertEquals("zz", part.getNextID());
+ assertEquals("zy", part.nextID());
+ assertEquals("zz", part.nextID());
}
- public void testGetNextIDLowercase2CharsRolloverFirst() {
+ public void testnextIDLowercase2CharsRolloverFirst() {
part = new AlphabeticIDPart("ay");
- assertEquals("az", part.getNextID());
- assertEquals("ba", part.getNextID());
- assertEquals("bb", part.getNextID());
+ assertEquals("az", part.nextID());
+ assertEquals("ba", part.nextID());
+ assertEquals("bb", part.nextID());
}
- public void testGetNextIDUppercase() {
+ public void testnextIDUppercase() {
part = new AlphabeticIDPart("A", "Z", "A");
- assertEquals("B", part.getNextID());
- assertEquals("C", part.getNextID());
+ assertEquals("B", part.nextID());
+ assertEquals("C", part.nextID());
part = new AlphabeticIDPart("A", "Z", "X");
- assertEquals("Y", part.getNextID());
- assertEquals("Z", part.getNextID());
+ assertEquals("Y", part.nextID());
+ assertEquals("Z", part.nextID());
}
- public void testGetNextIDUppercase2Chars() {
+ public void testnextIDUppercase2Chars() {
part = new AlphabeticIDPart("A", "Z", "AA");
- assertEquals("AB", part.getNextID());
- assertEquals("AC", part.getNextID());
+ assertEquals("AB", part.nextID());
+ assertEquals("AC", part.nextID());
part = new AlphabeticIDPart("A", "Z", "ZX");
- assertEquals("ZY", part.getNextID());
- assertEquals("ZZ", part.getNextID());
+ assertEquals("ZY", part.nextID());
+ assertEquals("ZZ", part.nextID());
}
- public void testGetNextIDUppercase2CharsRolloverFirst() {
+ public void testnextIDUppercase2CharsRolloverFirst() {
part = new AlphabeticIDPart("A", "Z", "AY");
- assertEquals("AZ", part.getNextID());
- assertEquals("BA", part.getNextID());
- assertEquals("BB", part.getNextID());
+ assertEquals("AZ", part.nextID());
+ assertEquals("BA", part.nextID());
+ assertEquals("BB", part.nextID());
}
- public void testResetLowercase() {
+ public void testresetIDLowercase() {
part = new AlphabeticIDPart("zx");
- assertEquals("zy", part.getNextID());
- assertEquals("zz", part.getNextID());
- part.reset();
+ assertEquals("zy", part.nextID());
+ assertEquals("zz", part.nextID());
+ part.resetID();
assertEquals("zx", part.getCurrentID());
}
- public void testResetUppercase() {
+ public void testresetIDUppercase() {
part = new AlphabeticIDPart("A", "Z", "RA");
- assertEquals("RB", part.getNextID());
- assertEquals("RC", part.getNextID());
- part.reset();
- assertEquals("RB", part.getNextID());
+ assertEquals("RB", part.nextID());
+ assertEquals("RC", part.nextID());
+ part.resetID();
+ assertEquals("RB", part.nextID());
}
part = new AlphabeticIDPart("aaa");
assertEquals("aaa", part.getCurrentID());
- assertEquals("aab", part.getNextID());
- assertEquals("aac", part.getNextID());
+ assertEquals("aab", part.nextID());
+ assertEquals("aac", part.nextID());
assertEquals("aac", part.getCurrentID());
- assertEquals("aad", part.getNextID());
+ assertEquals("aad", part.nextID());
}
part = new AlphabeticIDPart("A", "Z", "A");
assertEquals("A", part.getCurrentID());
- assertEquals("B", part.getNextID());
- assertEquals("C", part.getNextID());
+ assertEquals("B", part.nextID());
+ assertEquals("C", part.nextID());
assertEquals("C", part.getCurrentID());
- assertEquals("D", part.getNextID());
+ assertEquals("D", part.nextID());
}
public void testOverflowLowercase() {
part = new AlphabeticIDPart("zx");
- assertEquals("zy", part.getNextID());
- assertEquals("zz", part.getNextID());
- assertEquals("aaa", part.getNextID());
+ assertEquals("zy", part.nextID());
+ assertEquals("zz", part.nextID());
+ assertEquals("aaa", part.nextID());
}
public void testOverflowUppercase() {
part = new AlphabeticIDPart("A", "Z", "X");
- assertEquals("Y", part.getNextID());
- assertEquals("Z", part.getNextID());
- assertEquals("AA", part.getNextID());
+ assertEquals("Y", part.nextID());
+ assertEquals("Z", part.nextID());
+ assertEquals("AA", part.nextID());
}
pattern.add(new StringIDPart("E"));
pattern.add(new NumericIDPart("1"));
assertEquals("E1", pattern.getCurrentID("E"));
- assertEquals("E2", pattern.getNextID());
+ assertEquals("E2", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart());
pattern.add(new StringIDPart("."));
assertEquals("2009.", pattern.getCurrentID("2009"));
- assertEquals("2009.", pattern.getNextID());
+ assertEquals("2009.", pattern.nextID());
assertEquals("2010.", pattern.getCurrentID("2010"));
- assertEquals("2010.", pattern.getNextID());
+ assertEquals("2010.", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart());
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("1"));
assertEquals("2009.1", pattern.getCurrentID("2009."));
- assertEquals("2009.2", pattern.getNextID());
+ assertEquals("2009.2", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart());
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("55"));
assertEquals("2010.55", pattern.getCurrentID("2010."));
- assertEquals("2010.56", pattern.getNextID());
+ assertEquals("2010.56", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart("2009"));
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart());
assertEquals("2009.1", pattern.getCurrentID("2009."));
- assertEquals("2009.2", pattern.getNextID());
+ assertEquals("2009.2", pattern.nextID());
// Test a repeat of the last two operations.
assertEquals("2009.1", pattern.getCurrentID("2009."));
- assertEquals("2009.2", pattern.getNextID());
+ assertEquals("2009.2", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart("2009"));
pattern.add(new StringIDPart("-"));
pattern.add(new AlphabeticIDPart("a"));
assertEquals("2009.1-a", pattern.getCurrentID("2009.1-"));
- assertEquals("2009.1-b", pattern.getNextID());
+ assertEquals("2009.1-b", pattern.nextID());
assertEquals("2009.3-a", pattern.getCurrentID("2009.3-"));
}
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("55"));
assertEquals("2009.55", pattern.getCurrentID("2009.55"));
- assertEquals("2009.56", pattern.getNextID());
+ assertEquals("2009.56", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart("2009"));
pattern.add(new StringIDPart("-"));
pattern.add(new AlphabeticIDPart("a"));
assertEquals("2009.1-a", pattern.getCurrentID("2009.1-a"));
- assertEquals("2009.1-b", pattern.getNextID());
+ assertEquals("2009.1-b", pattern.nextID());
}
pattern.add(new YearIDPart("2009"));
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("1"));
- assertEquals("2009.2", pattern.getNextID());
- assertEquals("2009.3", pattern.getNextID());
+ assertEquals("2009.2", pattern.nextID());
+ assertEquals("2009.3", pattern.nextID());
pattern = new IDPattern();
pattern.add(new YearIDPart("2009"));
pattern.add(new NumericIDPart("1"));
pattern.add(new StringIDPart("-"));
pattern.add(new AlphabeticIDPart("a"));
- assertEquals("2009.1-b", pattern.getNextID());
- assertEquals("2009.1-c", pattern.getNextID());
+ assertEquals("2009.1-b", pattern.nextID());
+ assertEquals("2009.1-c", pattern.nextID());
pattern = new IDPattern();
pattern.add(new StringIDPart("T"));
pattern.add(new NumericIDPart("1005"));
- assertEquals("T1006", pattern.getNextID());
- assertEquals("T1007", pattern.getNextID());
+ assertEquals("T1006", pattern.nextID());
+ assertEquals("T1007", pattern.nextID());
}
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("1"));
pattern.add(new StringIDPart("-"));
- assertEquals("2009.1-", pattern.getNextID());
- assertEquals("2009.1-", pattern.getNextID());
+ assertEquals("2009.1-", pattern.nextID());
+ assertEquals("2009.1-", pattern.nextID());
}
pattern.add(new YearIDPart("2009"));
pattern.add(new StringIDPart("."));
pattern.add(new NumericIDPart("1"));
- assertEquals("2009.2", pattern.getNextID("2009.1"));
- assertEquals("2009.3", pattern.getNextID("2009.2"));
+ assertEquals("2009.2", pattern.nextID("2009.1"));
+ assertEquals("2009.3", pattern.nextID("2009.2"));
pattern = new IDPattern();
pattern.add(new YearIDPart("2009"));
pattern.add(new NumericIDPart("1"));
pattern.add(new StringIDPart("-"));
pattern.add(new AlphabeticIDPart("a"));
- assertEquals("2009.1-b", pattern.getNextID("2009.1-a"));
- assertEquals("2009.3-c", pattern.getNextID("2009.3-b"));
+ assertEquals("2009.1-b", pattern.nextID("2009.1-a"));
+ assertEquals("2009.3-c", pattern.nextID("2009.3-b"));
}
public void testNextID() {
part = new NumericIDPart("0");
- assertEquals("1", part.getNextID());
- assertEquals("2", part.getNextID());
- assertEquals("3", part.getNextID());
+ assertEquals("1", part.nextID());
+ assertEquals("2", part.nextID());
+ assertEquals("3", part.nextID());
part = new NumericIDPart("25");
- assertEquals("26", part.getNextID());
- assertEquals("27", part.getNextID());
- assertEquals("28", part.getNextID());
+ assertEquals("26", part.nextID());
+ assertEquals("27", part.nextID());
+ assertEquals("28", part.nextID());
}
try {
part = new NumericIDPart("997", "3");
- assertEquals("998", part.getNextID());
- assertEquals("999", part.getNextID());
- assertEquals("1000", part.getNextID());
+ assertEquals("998", part.nextID());
+ assertEquals("999", part.nextID());
+ assertEquals("1000", part.nextID());
fail("Should have thrown IllegalStateException here");
} catch (IllegalStateException expected) {
// This Exception should be thrown, and thus the test should pass.
// Tests default MAX_LENGTH value of 6 decimal places
try {
part = new NumericIDPart("999997");
- assertEquals("999998", part.getNextID());
- assertEquals("999999", part.getNextID());
- assertEquals("1000000", part.getNextID());
+ assertEquals("999998", part.nextID());
+ assertEquals("999999", part.nextID());
+ assertEquals("1000000", part.nextID());
fail("Should have thrown IllegalStateException here");
} catch (IllegalStateException expected) {
// This Exception should be thrown, and thus the test should pass.
}
- public void testReset() {
+ public void testresetID() {
part = new NumericIDPart("25");
- assertEquals("26", part.getNextID());
- assertEquals("27", part.getNextID());
- assertEquals("28", part.getNextID());
- part.reset();
- assertEquals("26", part.getNextID());
+ assertEquals("26", part.nextID());
+ assertEquals("27", part.nextID());
+ assertEquals("28", part.nextID());
+ part.resetID();
+ assertEquals("26", part.nextID());
}
part = new NumericIDPart("0");
assertEquals("0", part.getCurrentID());
- assertEquals("1", part.getNextID());
- assertEquals("2", part.getNextID());
+ assertEquals("1", part.nextID());
+ assertEquals("2", part.nextID());
assertEquals("2", part.getCurrentID());
- assertEquals("3", part.getNextID());
+ assertEquals("3", part.nextID());
part = new NumericIDPart("25");
assertEquals("25", part.getCurrentID());
public void testNextID() {
part = new StringIDPart("XYZ");
- assertEquals("XYZ", part.getNextID());
+ assertEquals("XYZ", part.nextID());
}
- public void testReset() {
+ public void testresetID() {
part = new StringIDPart(".");
- assertEquals(".", part.getNextID());
- part.reset();
- assertEquals(".", part.getNextID());
+ assertEquals(".", part.nextID());
+ part.resetID();
+ assertEquals(".", part.nextID());
}
/*
public void testNextID() {
part = new YearIDPart("XYZ");
- assertEquals("XYZ", part.getNextID());
+ assertEquals("XYZ", part.nextID());
}
- public void testReset() {
+ public void testresetID() {
part = new YearIDPart(".");
- assertEquals(".", part.getNextID());
- part.reset();
- assertEquals(".", part.getNextID());
+ assertEquals(".", part.nextID());
+ part.resetID();
+ assertEquals(".", part.nextID());
}