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
@SpringBootApplication | |
public class McySbJasyptApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(McySbJasyptApplication.class, args); | |
} | |
@Bean(name = "mcyEncryptor") | |
public StringEncryptor stringEncryptor() { | |
PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); |
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.mcy; | |
import javax.annotation.PostConstruct; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.stereotype.Component; | |
import lombok.extern.slf4j.Slf4j; | |
@Slf4j |
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
Geleneksel uygulama | On iki faktör uygulaması | ||
---|---|---|---|
Dağıtımlar arasındaki zaman | Haftalar | Saatler | |
Kod yazarları ve kod dağıtımcıları | Farklı insanlar | Aynı insanlar | |
Geliştirme ve ürün ortamı | Farklı | Olabildiğince benzer |
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
@RestController | |
public class RestService { | |
@Autowired | |
SecondService service; | |
@PostMapping("/post-service") | |
public Response restService(@RequestBody Request request) { | |
return new Response(request.getRequestValue1() + service.getValue(), request.getRequestValue2()); | |
} |
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
@Component | |
public class SecondService { | |
public String getValue() { | |
return "service"; | |
} | |
} |
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
//ORT: 2.186 MS | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration(classes = { McySbRestTestApplication.class }) | |
@WebAppConfiguration | |
public class RestServiceWebContextTest { | |
@Autowired | |
private WebApplicationContext wac; | |
private MockMvc mvc; |
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
// ORT: 556 MS | |
public class RestServiceStandaloneTest { | |
@InjectMocks | |
private RestService restService; | |
@Mock | |
private SecondService service; | |
private MockMvc mvc; | |
@Before |
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
public class WithoutExpectedExceptionTest { | |
@Test(expected = NullPointerException.class) | |
public void test() { | |
String value = null; | |
value.split(""); | |
} | |
@Test(expected = ArithmeticException.class) | |
public void test2() { |
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
public class ExpectedExceptionTest { | |
@Rule | |
public ExpectedException exp = ExpectedException.none(); | |
@Test | |
public void test() { | |
exp.expect(NullPointerException.class); | |
String value = null; | |
value.split(""); |
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
public class TestNameTest { | |
@Rule | |
public final TestName name = new TestName(); | |
@Test | |
public void testA() { | |
assertEquals("testA", name.getMethodName()); | |
} | |
@Test |