### Question:
WindowBuffer { void update(ParameterValue pval) { long genTime = pval.getGenerationTime(); int index=-1; for(int i=genTimes.length-1; i>=0; i--) { if(genTimes[i]==genTime) { break; } else if(genTimes[i]<genTime) { index=i; break; } } if(index==-1) { return; } for(int i=0; i<index; i++) { genTimes[i]=genTimes[i+1]; historicValues[i]=historicValues[i+1]; } genTimes[index]=genTime; historicValues[index]=pval; } WindowBuffer(int size); ParameterValue getHistoricValue(int instance); int getSize(); @Override String toString();  }### Answer:
@Test public void test() { WindowBuffer window = new WindowBuffer(5); assertBufferEquals(window, null, null, null, null, null); window.update(toPval(50, "a1")); window.update(toPval(60, "a2")); assertBufferEquals(window, null, null, null, "a1", "a2"); window.update(toPval(55, "a11")); assertBufferEquals(window, null, null, "a1", "a11", "a2"); window.update(toPval(10, "n")); assertBufferEquals(window, null, "n", "a1", "a11", "a2"); window.update(toPval(5, "n")); assertBufferEquals(window, "n", "n", "a1", "a11", "a2"); window.update(toPval(15, "n")); assertBufferEquals(window, "n", "n", "a1", "a11", "a2"); window.update(toPval(60, "n")); assertBufferEquals(window, "n", "n", "a1", "a11", "a2"); }