The document provides tips and tricks for testing lambda expressions in Android applications. It discusses how lambdas can be used instead of anonymous classes but are more difficult to unit test. It recommends avoiding lambdas and anonymous classes when possible, and instead implementing interfaces with concrete classes or by extending activities/fragments. When lambdas must be used, it suggests extracting logic to methods to make testing easier. The document also discusses tools like Robolectric, Butterknife and RxJava that can help improve testability when using lambdas.
AWS를 사용하는 게임 고객사를 대상으로 ‘Amazon GameLift 세션’ 을 준비했습니다.
GameLift는 클라우드에서 세션 기반 멀티플레이 게임 서버를 배포, 운영, 조정하는 데 사용되는 완전 관리형 서비스로, 본 행사에서는 Amazon GameLift를 이용한 세션형 1:1 게임 배포 실습을 진행합니다.
SCAIME - Digital load cells for packaging machinesSCAIME
Discover our extensive range of digital load cells especially designed for packaging machine manufacturers.
Smart load cells with embedded high performance weighing applications:
- High speed filling and dosing application for rotary fillers
- Dynamic weighing for chekcweighers
- Fieldbus connectivity CANOpen & Modbus-RTU
- Industrial Ethernet connectivity PROFINET & EtherNet/IP
EHEDG certified Load cell for hygienic and aseptic weighing application in Food and beverage industry.
Amazon Elastic Kubernetes Service (EKS)는 표준 Kubernetes 환경에서 실행되는 어플리케이션과 완벽히 호환됩니다. AWS상에서 Kubernetes 클러스터를 생성하고, 컨테이너 어플리케이션을 배포, 관리, 확장 및 로깅, 모니터링에 대한 실습과 함께, 최근 릴리즈된 AWS IAM 권한을 Pod에 할당하는 방법 등을 Amazon EKS에서 구현하는 과정을 진행합니다.
Microservices architecture involves many services that are being distributed over the network resulting in many more ways of failure. This session will try to cover the available tools that can help you when designing/building such distributed system in Go
클라우드 기반의 실시간 비딩 시스템 아키텍처를 구축하는 방법에 대해 설명하는 백서 [Building a Real-Time Bidding Platform on AWS]의 내용을 AWS 코리아의 김필중 솔루션즈 아키텍트가 한글로 요약한 슬라이드입니다. 어떻게 클라우드가 RTB의 필수 요소인 낮은 지연시간과 확장성을 확보하는 데 도움이 될 수 있는지 설명하고, 실제 고객 사례를 통해 이러한 아키텍처를 구성하는 법을 살펴보실 수 있습니다.
AWS를 사용하는 게임 고객사를 대상으로 ‘Amazon GameLift 세션’ 을 준비했습니다.
GameLift는 클라우드에서 세션 기반 멀티플레이 게임 서버를 배포, 운영, 조정하는 데 사용되는 완전 관리형 서비스로, 본 행사에서는 Amazon GameLift를 이용한 세션형 1:1 게임 배포 실습을 진행합니다.
SCAIME - Digital load cells for packaging machinesSCAIME
Discover our extensive range of digital load cells especially designed for packaging machine manufacturers.
Smart load cells with embedded high performance weighing applications:
- High speed filling and dosing application for rotary fillers
- Dynamic weighing for chekcweighers
- Fieldbus connectivity CANOpen & Modbus-RTU
- Industrial Ethernet connectivity PROFINET & EtherNet/IP
EHEDG certified Load cell for hygienic and aseptic weighing application in Food and beverage industry.
Amazon Elastic Kubernetes Service (EKS)는 표준 Kubernetes 환경에서 실행되는 어플리케이션과 완벽히 호환됩니다. AWS상에서 Kubernetes 클러스터를 생성하고, 컨테이너 어플리케이션을 배포, 관리, 확장 및 로깅, 모니터링에 대한 실습과 함께, 최근 릴리즈된 AWS IAM 권한을 Pod에 할당하는 방법 등을 Amazon EKS에서 구현하는 과정을 진행합니다.
Microservices architecture involves many services that are being distributed over the network resulting in many more ways of failure. This session will try to cover the available tools that can help you when designing/building such distributed system in Go
클라우드 기반의 실시간 비딩 시스템 아키텍처를 구축하는 방법에 대해 설명하는 백서 [Building a Real-Time Bidding Platform on AWS]의 내용을 AWS 코리아의 김필중 솔루션즈 아키텍트가 한글로 요약한 슬라이드입니다. 어떻게 클라우드가 RTB의 필수 요소인 낮은 지연시간과 확장성을 확보하는 데 도움이 될 수 있는지 설명하고, 실제 고객 사례를 통해 이러한 아키텍처를 구성하는 법을 살펴보실 수 있습니다.
Deploy Secure Network Architectures for The Connected EnterpriseRockwell Automation
Protecting industrial control and automation system (IACS) assets requires a holistic defense-in-depth security approach, which addresses internal and external security threats. This discussion reviews the security design and implementation considerations within the Cisco and Rockwell Automation® CPwE reference architectures. Learn about the architectural security framework, identity services, IDMZ, Stratix® 5950 and Cisco Adaptive Security Appliance (ASA) firewall solutions to help you improve the availability, integrity and confidentiality of your network architecture. Prior attendance of the NS05 - Building Converged Plantwide Ethernet Architectures session is recommended.
Stormpath .NET Developer Evangelist, Nate Barbettini, presents Token Authentication with ASP.NET Core. Nate will explain how Token Authentication can be used to secure web applications built with ASP.NET Core, REST APIs, and 'unsafe' clients while supporting security best practices and even improving performance and scale.
In this deck, I cover all the new exciting security feature we have in both gateway and APIC.
We are excited about the new features, and how they can be used to help protect the customer's deployment environment.
발표영상 다시보기: https://youtu.be/7KZtL1-MZNs
Amazon Quantum Ledger Database (QLDB)는 완전관리형 서버리스 원장 데이터베이스로, 중앙의 신뢰할 수 있는 기관이 소유하는 투명하고, 변경 불가능하며, 암호화 방식으로 검증 가능한 트랜잭션 로그를 제공합니다. 본 세션에서는 자동차 소유자의 운전 면허 갱신을 검증 및 추적할 수 있는 샘플 애플리케이션을 QLDB로 구축하는 사례를 통해 실제 애플리케이션에 활용하는 방법을 소개합니다. (2019년 11월 서울 리전 출시)
Pulsar is used by a portfolio of products at Splunk for stream processing of different types of data, including metrics and logs. In this talk, Karthik Ramasamy will share how Splunk helped a flagship customer scale a Pulsar deployment to handle 10 PB/day in a single cluster. He will talk about the journey, the challenges faced, and the trade-offs made to scale Pulsar and operate it reliably and stably in Google Cloud Platform (GCP).
Las arquitecturas sin servidores le permiten construir y ejecutar aplicaciones y servicios sin la necesidad de administrar la infraestructura que necesitan. Con las arquitecturas sin servidores en AWS su aplicación si se ejecuta en servidores pero toda la administración de los mismos la hace AWS.
En este webinar, usted aprenderá cómo construir aplicaciones y servicios mediante el uso de una arquitectura sin servidores o "serverless". Discutiremos cómo utilizar AWS Lambda para la ejecución de código para cualquier tipo de aplicación o servicio de backend; utilizar Amazon DynamoDB para almacenar los datos de la misma con una alta escalabilidad y redundancia; y utilizar Amazon API Gateway para crear y administrar puntos de conexión seguros API. También veremos un demo de cómo montar una arquitectura como estas y discutiremos las mejores prácticas y patrones utilizados por nuestros clientes para ejecutar aplicaciones sin servidores.
Objetivos de aprendizaje:
• Entender los conceptos básicos de arquitecturas sin servidores
• Aprender cómo usar Lambda, API Gateway y DynamoDB para ejecutar aplicaciones
¿Quién debería atender?:
• Desarrolladores, desarrolladores Web
Eggplant Digital Automation Intelligence for EpicEggplant
Eggplant is a suite of tools that makes sure Epic works as expected. It does this by connecting automated testing with robust analytics and insights to deliver a holistic experience. It ensures that data is flowing from one system to another without error.
본 게시물은 2019년 6월 18일에 AWS Game Team에서 진행한 GameLift 교육 자료입니다. GameLift는 클라우드에서 세션 기반 멀티플레이 게임 서버를 배포, 운영, 조정하는 데 사용되는 완전 관리형 서비스입니다. Amazon GameLift를 사용해 최고의 동급 전용 게임 서버 호스팅을 확보하십시오.
Lecture #6 - ET-3010
Cloud Computing - Overview and Examples
Connected Services and Cloud Computing
School of Electrical Engineering and Informatics SEEI / STEI
Institut Teknologi Bandung ITB
Update April 2017
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Amazon Web Services
Learning Objectives:
• Learn how to use CloudFront dynamic delivery features • See a live demo and learn how to take advantage of Cloud Front newest features
Traditionally, content delivery networks (CDNs) were designed to accelerate static content. Amazon CloudFront supports delivery of an entire website, including dynamic, static, streaming and interactive content using a global network of edge locations. CloudFront integrates with other AWS services that are built to scale massively. Together, the solution can automatically scale to millions of users by leveraging the global reach of CloudFront and the auto scaling capability of AWS platform. In this talk, we introduce you to various design patterns and best practices to build a massively scalable solution using CloudFront. We discuss how this scale can be achieved without compromising on availability, security or cost.
Here I speak about how you can quickly spin up a Laravel application and related topic such as Design Principles, Best practices, TDD and many more.
Take a look and share you thoughts.
Cheers!
During this presentation we are going to look at multiple solutions that are available for mocking JCR and go through their pros and cons. Then we are going to have look at Hippo Unit Test to see how Hippo Unit tester leverages JCR mocking to enable us to write easy to read and maintain unit tests.
Deploy Secure Network Architectures for The Connected EnterpriseRockwell Automation
Protecting industrial control and automation system (IACS) assets requires a holistic defense-in-depth security approach, which addresses internal and external security threats. This discussion reviews the security design and implementation considerations within the Cisco and Rockwell Automation® CPwE reference architectures. Learn about the architectural security framework, identity services, IDMZ, Stratix® 5950 and Cisco Adaptive Security Appliance (ASA) firewall solutions to help you improve the availability, integrity and confidentiality of your network architecture. Prior attendance of the NS05 - Building Converged Plantwide Ethernet Architectures session is recommended.
Stormpath .NET Developer Evangelist, Nate Barbettini, presents Token Authentication with ASP.NET Core. Nate will explain how Token Authentication can be used to secure web applications built with ASP.NET Core, REST APIs, and 'unsafe' clients while supporting security best practices and even improving performance and scale.
In this deck, I cover all the new exciting security feature we have in both gateway and APIC.
We are excited about the new features, and how they can be used to help protect the customer's deployment environment.
발표영상 다시보기: https://youtu.be/7KZtL1-MZNs
Amazon Quantum Ledger Database (QLDB)는 완전관리형 서버리스 원장 데이터베이스로, 중앙의 신뢰할 수 있는 기관이 소유하는 투명하고, 변경 불가능하며, 암호화 방식으로 검증 가능한 트랜잭션 로그를 제공합니다. 본 세션에서는 자동차 소유자의 운전 면허 갱신을 검증 및 추적할 수 있는 샘플 애플리케이션을 QLDB로 구축하는 사례를 통해 실제 애플리케이션에 활용하는 방법을 소개합니다. (2019년 11월 서울 리전 출시)
Pulsar is used by a portfolio of products at Splunk for stream processing of different types of data, including metrics and logs. In this talk, Karthik Ramasamy will share how Splunk helped a flagship customer scale a Pulsar deployment to handle 10 PB/day in a single cluster. He will talk about the journey, the challenges faced, and the trade-offs made to scale Pulsar and operate it reliably and stably in Google Cloud Platform (GCP).
Las arquitecturas sin servidores le permiten construir y ejecutar aplicaciones y servicios sin la necesidad de administrar la infraestructura que necesitan. Con las arquitecturas sin servidores en AWS su aplicación si se ejecuta en servidores pero toda la administración de los mismos la hace AWS.
En este webinar, usted aprenderá cómo construir aplicaciones y servicios mediante el uso de una arquitectura sin servidores o "serverless". Discutiremos cómo utilizar AWS Lambda para la ejecución de código para cualquier tipo de aplicación o servicio de backend; utilizar Amazon DynamoDB para almacenar los datos de la misma con una alta escalabilidad y redundancia; y utilizar Amazon API Gateway para crear y administrar puntos de conexión seguros API. También veremos un demo de cómo montar una arquitectura como estas y discutiremos las mejores prácticas y patrones utilizados por nuestros clientes para ejecutar aplicaciones sin servidores.
Objetivos de aprendizaje:
• Entender los conceptos básicos de arquitecturas sin servidores
• Aprender cómo usar Lambda, API Gateway y DynamoDB para ejecutar aplicaciones
¿Quién debería atender?:
• Desarrolladores, desarrolladores Web
Eggplant Digital Automation Intelligence for EpicEggplant
Eggplant is a suite of tools that makes sure Epic works as expected. It does this by connecting automated testing with robust analytics and insights to deliver a holistic experience. It ensures that data is flowing from one system to another without error.
본 게시물은 2019년 6월 18일에 AWS Game Team에서 진행한 GameLift 교육 자료입니다. GameLift는 클라우드에서 세션 기반 멀티플레이 게임 서버를 배포, 운영, 조정하는 데 사용되는 완전 관리형 서비스입니다. Amazon GameLift를 사용해 최고의 동급 전용 게임 서버 호스팅을 확보하십시오.
Lecture #6 - ET-3010
Cloud Computing - Overview and Examples
Connected Services and Cloud Computing
School of Electrical Engineering and Informatics SEEI / STEI
Institut Teknologi Bandung ITB
Update April 2017
Scaling to millions of users with Amazon CloudFront - April 2017 AWS Online T...Amazon Web Services
Learning Objectives:
• Learn how to use CloudFront dynamic delivery features • See a live demo and learn how to take advantage of Cloud Front newest features
Traditionally, content delivery networks (CDNs) were designed to accelerate static content. Amazon CloudFront supports delivery of an entire website, including dynamic, static, streaming and interactive content using a global network of edge locations. CloudFront integrates with other AWS services that are built to scale massively. Together, the solution can automatically scale to millions of users by leveraging the global reach of CloudFront and the auto scaling capability of AWS platform. In this talk, we introduce you to various design patterns and best practices to build a massively scalable solution using CloudFront. We discuss how this scale can be achieved without compromising on availability, security or cost.
Here I speak about how you can quickly spin up a Laravel application and related topic such as Design Principles, Best practices, TDD and many more.
Take a look and share you thoughts.
Cheers!
During this presentation we are going to look at multiple solutions that are available for mocking JCR and go through their pros and cons. Then we are going to have look at Hippo Unit Test to see how Hippo Unit tester leverages JCR mocking to enable us to write easy to read and maintain unit tests.
Javascript testing (Javascript unit test) is an essential part when your developer is using logic in his code. Like hundreds of other things in the world of JavaScript , there are many choices for how to unit test the code. Here we compare some best javascript testing unit tools like karma, jasmine, Qunit, Mocha etc.
Play with Testing on Android - Gilang Ramadhan (Academy Content Writer at Dic...DicodingEvent
Testing merupakan (QA) quality assurance dari sebuah produk. Dalam tahap ini kita jadi tahu, bila di dalam aplikasi yang kita buat terdapat bug, eror, atau salah dalam logika kode. Sehingga testing adalah bagian terpenting pada pengembangan aplikasi.
Eror bisa kita identifikasi jauh lebih dini sebelum proses produksi. Jika terjadi kesalahan dalam tahap produksi, itu sudah melibatkan user. Tentunya kerugian di dalam tahap ini akan lebih fatal. Faktanya, biaya perbaikan sebuah aplikasi eror di tahap produksi, lebih besar dibandingkan dengan biaya pengujian sebelum produksi.
Anda akan mempelajari:
- Mengapa perlu melakukan testing
- Apa sebenarnya yang dimaksud testing
- Apa saja tools yang bisa Anda manfaatkan
Ryan Goulding and Colin Dixon's presentation from the 2017 Open Networking Summit on Making Strongly-typed NETCONF Usable.
NETCONF's use of strongly-typed YANG to describe device configuration makes safe and robust device configuration possible, but also exposes complexities in operation. Most deployments choose to use a controller or management system to help with issues of inventory and credential management. Further, this controller often does sanity checks to ensure that operations are likely to be successful on devices and, if not, there is useful debugging information. Frustratingly, this exposes trade-offs between relying on strict enforcement of YANG to catching errors early and more relaxed behavior to enable compatibility with imperfect NETCONF implementations in the real world. We show how we navigated these trade-offs to provide a flexible, open-source NETCONF solution that is strongly-typed and enables simple configuration changes for compatibility with imperfect NETCONF implementations.
Progressive Web App Testing With Cypress.ioKnoldus Inc.
Cypress.io is a frontend automation testing tool built for modern web applications developed on some of the emerging technologies like Reactjs, Ionic, Vue, and Angular.
Cypress is a test automation tool that can perform fast, easy and reliable testing for anything that runs in a browser.
Angular Unit testing
Introduction to Angular Unit testing
Angular Test Cases are automated tests written to check the functionality of an Angular application.
These tests are designed to ensure that the application is working as expected and that all components are functioning correctly.
Angular Test Cases provide a way to quickly and accurately verify that the application is working properly.
They can also be used to quickly identify any bugs or errors that may have been introduced during development.
Why do we use Angular test cases?
Using Angular test cases is important for ensuring the quality of your application's codebase.
Test cases help to detect bugs and errors in the code quickly, so that the development team can address them and fix them before they become bigger problems.
Test cases also help to make sure that new features are implemented correctly and that existing features continue to work as expected.
Finally, using test cases can help to reduce the risk of introducing new bugs into the codebase.
Unit Testing
Testing single unit of code in isolation from the rest of the code which tests behavior of a function or class
Unit testing with Jasmine and Karma for Angular Apps!
Jasmine
Jasmine is an open-source JavaScript testing framework.
JavaScript testing framework provides building blocks to write JavaScript unit test cases so each line of JavaScript statement is properly unit tested.
It is used to test any type of JavaScript application.
Jasmine is a BDD (Behavior Driven Development)
In BDD Test are written in Non-technical language so everyone can understand it easily.
BDD manly focus on the testing the behavior of code rather than implementation.
Writing test cases with Jasmine
Test cases in Jasmine are written using the ‘describe’ and ‘it’ functions. The ‘describe’ function is used to create a suite of tests, while the ‘it’ function is used to define the individual test cases.
To create a test case, first the ‘describe’ function is used to create a suite of tests and assign it a name. Then the ‘it’ function is used to define the individual test cases within the suite.
For each test case, you define the behavior you expect from the JavaScript application. You can also use assertions to test the output of the application.
Flow of Unit Test case
The Angular testing package includes two utilities called TestBed and async.
TestBed is the main Angular utility package.
The describe container contains different blocks (it, beforeEach, xit, etc.).beforeEach runs before any other block.
Karma
Karma is a testing automation tool created by the Angular JS team.
Karma is Open source tool.
Karma is a tool made on top of NodeJS to run JavaScript test cases. This is not a testing framework like Jasmine or Mocha or Chai etc.
It only allows us to run JavaScript test cases written using testing frameworks like Jasmine.
Karma allow us to execute the test cases on any browsers.
Front-end Testing (manual, automated, you name it) - Erich Jagomägis - Develo...MobileMonday Estonia
Presented on Monday, 12 September 2016 at MobileMonday Estonia: "Back to Basics - Testing"
http://www.momoestonia.com/2016/09/mobilemonday-back-to-basics-testing.html
Core Java Tutorial. In case you want to get trained in Spring Framework you can refer here:
<a href="https://www.emexotechnologies.com/courses/java-development-training/core-java-training/">Java Training</a>
Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible
Similar to Tips and Tricks for Testing Lambda Expressions in Android (20)
Tips and Tricks for Testing Lambda Expressions in Android
1. Tips and Tricks for Testing
Lambda Expressions in Android
David Carver
CareWorks Tech
Google Plus: David Carver
Github: kingargyle
2. Agenda
● Anonymous Classes and Lambdas
○ Definitions
○ Use in Android Applications
■ Lambdas in Android
● Retro Lambda
● Jack and Jill
● The Problems
● Tips and Tricks
3.
4. Unit Testing vs Integration Testing
Unit Tests try to test the smallest portion of code individually
and independently … for proper operation.
Integration Tests test blocks of code as a group. It occurs after
unit testing and before validation testing.
6. Anonymous Classes
As defined by Java In a Nutshell, “an anonymous class is defined and instantiated in a
single succinct expression using the new operator”
7. Where are Anonymous Classes Commonly Used in
Android?
● Runnables
● View Listeners
○ OnClickListener, OnLongClickListener, OnFocusChangeListener,
OnDragListener, OnTouchListener, etc
● Comparators
● Handler Callbacks
● Loaders
○ OnLoadCanceledListener
○ OnLoadCompleteListener
8. What Are Lambda Expressions?
Microsoft MSDN, July 20, 2015
A lambda expression is an anonymous function that you can use to create delegates or
expressions….you can write local functions that can be passed as arguments or returned
as the value of the function.
9. What Are Lambda Expressions?
Another way to pass code blocks around, but in a more compact syntax.
Lambda encourage you to do functional (what you want down, not specifically how it
is done) programming instead of an imperative (procedural, how it should be done).
10. Lambdas vs Anonymous Classes
Lambdas allow a cleaner syntax for Anonymous Classes that contain a
single method that needs to be implemented .
12. Android and Lambdas
● RetroLambda - https://github.com/orfjackal/retrolambda
○ Backports the Java 8 support for Lambdas
○ Allows the use Lambdas all the way back to Java 5.
○ Generates code at compile time
○ Gradle Plugin - https://github.com/evant/gradle-retrolambda
● Jack and Jill - http://tools.android.com/tech-docs/jackandjill
○ Android specific compiler
○ Natively supports Java 8 and Lambdas
○ Only supports back to Java 7
■ No Java 6 support for older devices
○ Will be the standard android compiler going forward.
13. So What is the Problem?
Lambdas as used in Java currently, are a cleaner syntax for single method anonymous
classes.
● Trying to write tests leads to writing integration tests
● Leads to duplication of Code
● Can lead to hard to maintain code
○ Multiple inline overrides embedded multiple levels deep.
● Testing code that requires a Framework or other layers to work leads to tests that
need more setup.
○ Can lead to longer execution time of your tests
○ More difficult to setup tests
14. Performance
Lambda Expressions are not as
optimized by the compiler
currently as standard imperative
ways of accomplishing the same
thing.
Imperative is still faster in the
following areas:
● Iterators
● For Each
Benchmarks are tricky and can be
misleading, but be careful going
hog wild with lambdas as they can
introduce slow points in your code.
http://blog.takipi.com/benchmark-how-java-8-lambdas-and-streams-can-make-your-code-5-times-slower/
15. Anonymous Classes plague Graphical User Interface work.
They are convenient. However, hard to unit test.
Lambdas can be used many places that you would
implement an Anonymous class.
They suffer the same testing problem as Anonymous
Classes.
It leads to integration testing and not unit testing.
23. Where are Lambdas Commonly Used in Android?
● RXJava and RXJava for Android
○ Anywhere the Action class/interface would normally be implemented.
○ Anywhere where anonymous inline overrides would have been used.
○ If you are doing RX… you are probably using Lambdas otherwise you go insane.
● Implementation of Interfaces
○ Handlers
○ Runnables
○ Listeners
○ Any place you could use an anonymous class with a single method.
All of these places are also where you typically have Unit Testing pain points.
24. What is RXJava and RX Android?
A library for composing asynchronous and
event-based programs by using observable
sequences.
It is an implementation of ReactiveX (Reactive
Extensions).
https://github.com/ReactiveX/RxJava/wiki
27. Implement Concrete Class from Interface
● Simple POJO
● Typically the fastest to execute
● Typically the least complicated to setup
● Can be reused in other places in your application.
Many Android examples use Anonymous Classes.
Stop following these examples.
28. Implement the Interface on a View/Fragment/Activity
This is fine .... until your class starts becoming a GOD class that
wants to do everything.
Avoid GOD classes… they become a nightmare to test.
30. Robolectric and Butterknife
● Robolectric
○ Unit Test Framework that runs on your computer
■ No Device needed
■ No Simulator
■ Simulates Android
■ Runs on your machine.
● ButterKnife
○ Developed by Jake Wharton
○ Part of the Square Development Stack
○ Generates Code based on Annotations
■ @BindView, @BindInt, @BindBoolean
■ @OnClick, @OnLongClick
33. ButterKnife Testing Advantages
● No Anonymous classes
● Lambdas are not necessary
● Less Likely to lead to an Integration Test
○ Allows for a pure unit test without executing more code than necessary
● Simpler tests
○ Leading to faster execution of the tests
● Cleaner Code leading to easier maintenance
● Can Bind onClicks to multiple views allowing for easier code re-use.
34. Testing Lambdas in RXJava
● RXJava allows for easier implementation of Async Tasks
○ File operations
○ Database Acccess
○ Remote Procedure Calls
○ Any type of Background Tasks
○ Can support Event Bus style notifications
● Lambdas can make writing RXJava Observables cleaner
○ No Messy inline override syntax
● However, RXJava leads to more Integration Style Tests
● Tests are harder to setup, and more complicated to verify and isolate.
35. Common RXJava Test Situations
● Subscribers and Error conditions
● Subjects
● Map Flatteners
● Joins
The simplest way to test these is to extract the functionality to a method, and test the
code that is intended to be executed separately.
37. Extract to Method
Extracting this out allows for testing of the expected behavior of this code without
executing the subscribe directly. It also keeps your code potentially cleaner.
38. RXJava TestSubscriber
● Allows you to execute the subscribe, and error portions of an RXJava Observable.
● Provides the simplest method for executing the least amount of code possible.
● Use in combination with Mockito/EasyMock to provide mocks for the
Observables that are being subscribed too.
● This is still an Integration Test
○ Requires RXJava Framework to execute in order to test the conditions and code in the Lambda
expression.
○ Less Complicated though than trying to Mock Out the RXJava Framework itself.
43. Summary
● Leverage Lambdas
○ Make sure you are using for the right reasons, not because you can.
○ They can provide cleaner code, but can make it more complicated to test.
● Prefer implementing your Interfaces as re-usable classes
○ Easier to strictly unit test
○ Reduce code duplication
● Leverage Butterknife when possible for binding click events
○ Allows simpler tests
○ Cleaner test setup and execution
● Consider extracting lambdas that contain complicated code to either Classes or
methods.