@Test(expected = IllegalStateException.class) public void pretendDoubleQubicTransaction() { QubicWriter qwriter = new QubicWriter(); try { qwriter.publishQubicTransaction(); } catch (IllegalStateException e) { fail("this first qubic transaction should have worked"); } qwriter.publishQubicTransaction(); }
public synchronized void publishQubicTransaction() { if(state != QubicWriterState.PRE_ASSEMBLY_PHASE) throw new IllegalStateException("qubic transaction can only be published if qubic is in state PRE_ASSEMBLY_PHASE, but qubic is in state " + state.name()); editable.throwExceptionIfTooLateToPublish(); finalSpecification = new QubicSpecification(editable); JSONObject qubicTransactionJSON = finalSpecification.generateQubicTransactionJSON(); qubicTransactionHash = writer.write(QUBIC_TRANSACTION_IAM_INDEX, qubicTransactionJSON); state = QubicWriterState.ASSEMBLY_PHASE; }
QubicWriter { public synchronized void publishQubicTransaction() { if(state != QubicWriterState.PRE_ASSEMBLY_PHASE) throw new IllegalStateException("qubic transaction can only be published if qubic is in state PRE_ASSEMBLY_PHASE, but qubic is in state " + state.name()); editable.throwExceptionIfTooLateToPublish(); finalSpecification = new QubicSpecification(editable); JSONObject qubicTransactionJSON = finalSpecification.generateQubicTransactionJSON(); qubicTransactionHash = writer.write(QUBIC_TRANSACTION_IAM_INDEX, qubicTransactionJSON); state = QubicWriterState.ASSEMBLY_PHASE; } }
QubicWriter { public synchronized void publishQubicTransaction() { if(state != QubicWriterState.PRE_ASSEMBLY_PHASE) throw new IllegalStateException("qubic transaction can only be published if qubic is in state PRE_ASSEMBLY_PHASE, but qubic is in state " + state.name()); editable.throwExceptionIfTooLateToPublish(); finalSpecification = new QubicSpecification(editable); JSONObject qubicTransactionJSON = finalSpecification.generateQubicTransactionJSON(); qubicTransactionHash = writer.write(QUBIC_TRANSACTION_IAM_INDEX, qubicTransactionJSON); state = QubicWriterState.ASSEMBLY_PHASE; } QubicWriter();  QubicWriter(IAMWriter writer); }
QubicWriter { public synchronized void publishQubicTransaction() { if(state != QubicWriterState.PRE_ASSEMBLY_PHASE) throw new IllegalStateException("qubic transaction can only be published if qubic is in state PRE_ASSEMBLY_PHASE, but qubic is in state " + state.name()); editable.throwExceptionIfTooLateToPublish(); finalSpecification = new QubicSpecification(editable); JSONObject qubicTransactionJSON = finalSpecification.generateQubicTransactionJSON(); qubicTransactionHash = writer.write(QUBIC_TRANSACTION_IAM_INDEX, qubicTransactionJSON); state = QubicWriterState.ASSEMBLY_PHASE; } QubicWriter();  QubicWriter(IAMWriter writer); synchronized void publishQubicTransaction(); void promote(); synchronized void publishAssemblyTransaction(); String getID(); List<JSONObject> fetchApplications(); String getQubicTransactionHash(); String getAssemblyTransactionHash(); IAMWriter getIAMWriter(); List<String> getAssembly(); EditableQubicSpecification getEditable(); QubicSpecification getSpecification(); String getState(); }
QubicWriter { public synchronized void publishQubicTransaction() { if(state != QubicWriterState.PRE_ASSEMBLY_PHASE) throw new IllegalStateException("qubic transaction can only be published if qubic is in state PRE_ASSEMBLY_PHASE, but qubic is in state " + state.name()); editable.throwExceptionIfTooLateToPublish(); finalSpecification = new QubicSpecification(editable); JSONObject qubicTransactionJSON = finalSpecification.generateQubicTransactionJSON(); qubicTransactionHash = writer.write(QUBIC_TRANSACTION_IAM_INDEX, qubicTransactionJSON); state = QubicWriterState.ASSEMBLY_PHASE; } QubicWriter();  QubicWriter(IAMWriter writer); synchronized void publishQubicTransaction(); void promote(); synchronized void publishAssemblyTransaction(); String getID(); List<JSONObject> fetchApplications(); String getQubicTransactionHash(); String getAssemblyTransactionHash(); IAMWriter getIAMWriter(); List<String> getAssembly(); EditableQubicSpecification getEditable(); QubicSpecification getSpecification(); String getState();  }