I hereby claim:
- I am matmerr on github.
- I am matmerr (https://keybase.io/matmerr) on keybase.
- I have a public key ASD6hBG64gzFqWJKbHlQfYa2N2OJ3zFTdCqMsOg1Pa_1dQo
To claim this, I am signing this object:
| #!/bin/bash | |
| clear | |
| function description { | |
| cmd=("$@") | |
| echo -e "${cmd[*]}\n" | |
| } | |
| function execute { | |
| cmd=("$@") | |
| echo -e "${cmd[*]}\n" |
| @RunWith(PowerMockRunner.class) | |
| @PrepareForTest({Calendar.class, Date.Class}) | |
| public class CalendarUnitTest { | |
| @Mock | |
| Date mDate | |
| @Test | |
| public oid testMainWithvalidDate() throws Exception { |
| // Here's the full unit test | |
| public class LateInvoiceNotifierTest { | |
| //Class to be tested | |
| private LateInvoiceNotifier lateInvoiceNotifier; | |
| //Dependencies (will be mocked) | |
| private EmailSender emailSender; | |
| private InvoiceStorage invoiceStorage; |
| // Stub example: | |
| // customer code | |
| @Entity | |
| public class Customer { | |
| @Id | |
| @GeneratedValue(strategy = GenerationType.AUTO) | |
| private long id; | |
| private String firstName; | |
| private String lastName; | |
| //...getters and setters redacted for brevity... |
| //-------------------------------------------------- | |
| @Test | |
| public void whenNotUseMockAnnotation_thenCorrect() { | |
| List mockList = Mockito.mock(ArrayList.class); | |
| mockList.add("one"); | |
| Mockito.verify(mockList).add("one"); | |
| assertEquals(0, mockList.size()); | |
| Mockito.when(mockList.size()).thenReturn(100); |
| //-------------------------------------------------- | |
| In the following example – we create a spy of a List with the old way without using @Spy annotation: | |
| @Test | |
| public void whenNotUseSpyAnnotation_thenCorrect() { | |
| List<String> spyList = Mockito.spy(new ArrayList<String>()); | |
| spyList.add("one"); | |
| spyList.add("two"); | |
| //-------------------------------------------------- | |
| In the following example – we use @InjectMocks to inject the mock wordMap into the MyDictionary dic: | |
| @Mock | |
| Map<String, String> wordMap; | |
| @InjectMocks | |
| MyDictionary dic = new MyDictionary(); | |
| @Test |
| Let's imagine your computer is a dining room and the food is computer resources | |
| Old operating systems served the food buffet style. ALL the food was put out and people just came in and had all they wanted. Naturally, people (programs) who came in later had less food to choose from. | |
| So we upgrade the operating system to include some multi-tasking rules. And we teach people (programs) how to form a line, take only one plate of food at a time, and this makes things more fair and manageable. This works so well that soon we had rules (like "please" and "thank you" and asking people to "pass" things) that enabled everyone to SIT at the table and enjoy a nice dinner together. It was great -- as long as everyone knew the rules. | |
| But kids don't know the rules. And often, kids can't understand the rules if you explain them. So the kids keep running into the room and grabbing whatever they want from the table, being greedy, eating from other people's plates, causing a mess and creating chaos. | |
| So we create a "kids table. |
I hereby claim:
To claim this, I am signing this object:
| FROM node as node-build | |
| WORKDIR /app | |
| COPY . . | |
| RUN yarn && yarn build | |
| FROM nginx:alpine | |
| WORKDIR /usr/share/nginx | |
| RUN rm -rf * | |
| COPY --from=node-build /app/build/ html/ | |
| EXPOSE 80 |