test_class.declarator: mapWithUuidKey
test_class.modifier: @Mock
test_class.original_string: @Mock
  	IMap<UUID, AggregateRootHistory> mapWithUuidKey;
test_class.type: IMap<UUID, AggregateRootHistory>
test_class.var_name: mapWithUuidKey
test_class.file: myeslib-hazelcast/src/test/java/org/myeslib/hazelcast/storage/HzUnitOfWorkJournalTest.java
test_class.identifier: HzUnitOfWorkJournalTest
test_case.body: @Test
  	public void withoutConcurrencyException() {
  		
  		UUID id = UUID.randomUUID();
  		Command command = new IncreaseInventory(UUID.randomUUID(), id, 1, 0L);
  		Event event1 = new InventoryIncreased(id, 1);
  		List<Event> events = Arrays.asList(event1);
  		UnitOfWork t = UnitOfWork.create(UUID.randomUUID(), command, events);
  		AggregateRootHistory toStore = new AggregateRootHistory();
  		toStore.add(t);
  		
  		when(mapWithUuidKey.get(id)).thenReturn(toStore);
  		
  		HzUnitOfWorkJournal<UUID> store = new HzUnitOfWorkJournal<>(mapWithUuidKey);
  		Command command2 = new IncreaseInventory(UUID.randomUUID(), id, 1, 1L);
  		UnitOfWork t2 = UnitOfWork.create(UUID.randomUUID(), command2, events);
  		store.append(id, t2);
  
  		ArgumentCaptor<UUID> argumentKey = ArgumentCaptor.forClass(UUID.class);
  		ArgumentCaptor<AggregateRootHistory> argumentValue = ArgumentCaptor.forClass(AggregateRootHistory.class);
  
  		verify(mapWithUuidKey, times(1)).set(argumentKey.capture(), argumentValue.capture());
  		
  		// checks for key
  		assertThat(argumentKey.getValue(), sameInstance(id));
  
  		AggregateRootHistory asObj = argumentValue.getValue();
  
  		// should have 2 transactions
  		assertThat(asObj.getUnitsOfWork().size(), is(2));
  
  		// checks for all transactions fields except the timestamp
  		UnitOfWork copy = asObj.getUnitsOfWork().get(0);
  		assertThat(copy.getCommand(), is(command));
  		assertThat(copy.getVersion(), is(1l));
  		assertThat("contains events", copy.getEvents().containsAll(events));
  
  		// checks for all transactions fields except the timestamp
  		UnitOfWork t2Candidate = asObj.getUnitsOfWork().get(1);
  		assertThat(t2Candidate.getCommand(), is(command2));
  		assertThat(t2Candidate.getVersion(), is(2l));
  		assertThat("contains events", t2Candidate.getEvents().containsAll(events));
  
  	}
test_case.class_method_signature: HzUnitOfWorkJournalTest.withoutConcurrencyException()
test_case.full_signature: @Test public void withoutConcurrencyException()
test_case.identifier: withoutConcurrencyException
test_case.invocations: randomUUID randomUUID asList create randomUUID add thenReturn when get randomUUID create randomUUID append forClass forClass set verify times capture capture assertThat getValue sameInstance getValue assertThat size getUnitsOfWork is get getUnitsOfWork assertThat getCommand is assertThat getVersion is assertThat containsAll getEvents get getUnitsOfWork assertThat getCommand is assertThat getVersion is assertThat containsAll getEvents
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void withoutConcurrencyException()
focal_class.declarator: pastTransactionsMap
focal_class.modifier: private final
focal_class.original_string: private final IMap<K, AggregateRootHistory> pastTransactionsMap ;
focal_class.type: IMap<K, AggregateRootHistory>
focal_class.var_name: pastTransactionsMap
focal_class.file: myeslib-hazelcast/src/main/java/org/myeslib/hazelcast/storage/HzUnitOfWorkJournal.java
focal_class.identifier: HzUnitOfWorkJournal
focal_class.interfaces: implements UnitOfWorkJournal<K>
focal_class.class_method_signature: HzUnitOfWorkJournal.HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.full_signature: @Inject public  HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.identifier: HzUnitOfWorkJournal
focal_class.modifiers: @Inject public
focal_class.parameters: (IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.signature:  HzUnitOfWorkJournal(IMap<K, AggregateRootHistory> pastTransactionsMap)
focal_class.class_method_signature: HzUnitOfWorkJournal.append(final K id, final UnitOfWork uow)
focal_class.full_signature: public void append(final K id, final UnitOfWork uow)
focal_class.identifier: append
focal_class.modifiers: public
focal_class.parameters: (final K id, final UnitOfWork uow)
focal_class.return: void
focal_class.signature: void append(final K id, final UnitOfWork uow)
focal_class.class_method_signature: HzUnitOfWorkJournal.getHistoryFor(final K id)
focal_class.full_signature: private AggregateRootHistory getHistoryFor(final K id)
focal_class.identifier: getHistoryFor
focal_class.modifiers: private
focal_class.parameters: (final K id)
focal_class.return: AggregateRootHistory
focal_class.signature: AggregateRootHistory getHistoryFor(final K id)
focal_method.body: public void append(final K id, final UnitOfWork uow) {
  		checkNotNull(id);
  		checkNotNull(uow);
  		final AggregateRootHistory history = getHistoryFor(id);
  		if (!history.getLastVersion().equals(uow.getTargetVersion())){
  			throw new ConcurrentModificationException(String.format("version %s does not match the expected %s ****", 
  																	history.getLastVersion().toString(), 
  																	uow.getTargetVersion().toString())
  													 );
  														
  		} 
  		log.info("will set {}", id);
  		history.add(uow);
  		pastTransactionsMap.set(id, history); // hazelcast optimization --> set instead of put since is void
  	}
focal_method.class_method_signature: HzUnitOfWorkJournal.append(final K id, final UnitOfWork uow)
focal_method.full_signature: public void append(final K id, final UnitOfWork uow)
focal_method.identifier: append
focal_method.invocations: checkNotNull checkNotNull getHistoryFor equals getLastVersion getTargetVersion format toString getLastVersion toString getTargetVersion info add set
focal_method.modifiers: public
focal_method.parameters: (final K id, final UnitOfWork uow)
focal_method.return: void
focal_method.signature: void append(final K id, final UnitOfWork uow)