This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.idspring.commandpattern.service.command; | |
import com.idspring.commandpattern.entity.Cart; | |
import com.idspring.commandpattern.model.service.AddProductToCartRequest; | |
import com.idspring.commandpattern.service.Command; | |
/** | |
* @author Eko Kurniawan Khannedy | |
* @since 30/06/17 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.idspring.commandpattern.service; | |
import com.idspring.commandpattern.model.service.ServiceRequest; | |
import reactor.core.publisher.Mono; | |
/** | |
* @author Eko Kurniawan Khannedy | |
* @since 30/06/17 | |
*/ | |
public interface Command<RESULT, REQUEST extends ServiceRequest> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.idspring.commandpattern.service.impl; | |
import com.idspring.commandpattern.entity.Cart; | |
import com.idspring.commandpattern.entity.CartItem; | |
import com.idspring.commandpattern.entity.Product; | |
import com.idspring.commandpattern.model.service.AddProductToCartRequest; | |
import com.idspring.commandpattern.model.service.CreateNewCartRequest; | |
import com.idspring.commandpattern.model.service.RemoveProductFromCartRequest; | |
import com.idspring.commandpattern.model.service.UpdateProductInCartRequest; | |
import com.idspring.commandpattern.repository.CartRepository; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.idspring.commandpattern.service; | |
import com.idspring.commandpattern.entity.Cart; | |
import com.idspring.commandpattern.model.service.AddProductToCartRequest; | |
import com.idspring.commandpattern.model.service.CreateNewCartRequest; | |
import com.idspring.commandpattern.service.command.RemoveProductFromCartCommand; | |
import reactor.core.publisher.Mono; | |
/** | |
* @author Eko Kurniawan Khannedy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blibli.kotlin.model.request | |
import org.hibernate.validator.constraints.Length | |
import org.hibernate.validator.constraints.NotBlank | |
/** | |
* @author Eko Kurniawan Khannedy | |
*/ | |
data class PersonCreateRequest( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blibli.kotlin.model.request; | |
import org.hibernate.validator.constraints.Length; | |
import org.hibernate.validator.constraints.NotBlank; | |
/** | |
* @author Eko Kurniawan Khannedy | |
*/ | |
public class PersonCreateRequestJava { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blibli.kotlin.model.request | |
import org.hibernate.validator.constraints.Length | |
import org.hibernate.validator.constraints.NotBlank | |
/** | |
* @author Eko Kurniawan Khannedy | |
*/ | |
data class PersonCreateRequest( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testNewInstance() { | |
Foo foo = BeanUtils.instantiate(Foo.class); | |
Assert.assertNotNull(foo); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testManualNewInstance() { | |
try { | |
Foo foo = Foo.class.newInstance(); | |
Assert.assertNotNull(foo); | |
} catch (InstantiationException | IllegalAccessException e) { | |
Assert.fail(e.getMessage()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testCopyManual() throws Exception { | |
Foo foo1 = new Foo(1L, "Eko", "Khannedy"); | |
Foo foo2 = new Foo(); | |
foo2.setId(foo1.getId()); | |
foo2.setFirstName(foo1.getFirstName()); | |
foo2.setLastName(foo1.getLastName()); | |
Assert.assertEquals(foo1.getId(), foo2.getId()); |